0

I'm looking for a script that read all my files and find those which have int tube[2] written at the beginning of any line, I should use

sed -e 's/Ancien/Nouveau/g' nomFichierEntrée > nomFichierSortie

But how to loop on my files?

for int i in ls do
    sed '^int tube[2]'
loop?

or am I missing something?

And how to use it?

2 Answers2

1
grep -l '^int tube\[2]' ./*

Would list the non-hidden files in the current directory that have at least one line that starts with int tube[2]. The [ needs to be escaped as it's a regexp operator.

In any case, parsing the output of ls is generally a bad idea.

0
for i in $( ls ); do
.
.
.
done
Bibek_G
  • 549