I have a folder with some sql files and I want to import everything with a script using sqlplus. Inside the folder I do this and it works, converted all the files into a single one:
for filename in $(ls *.sql);
do
cat $filename >> all.sql
done
But my problem is, some of this sql files had "ADM" on the title, and I want to put this files into other file, because they have a different user/pass on DB. So, what i need is:
for filename in $(ls *ADM*.sql);
do
cat $filename >> all_ADM.sql
done
for filename in --Rule that catch all files with ".sql" but without "ADM" in the title--
do
cat $filename >> all.sql
done
I'm not so good with regex and I already try a lot of things that I found on the internet, but without success. Thanks!!