Hallo,
i want to parse all files in a folder recursively. The 'sed' command works properly if i pass a literal name but it fails if i run it in this 'for' loop.
I tried many variations with quotes and double quotes as well as -print0/'xargs -0' examples but it looks like i'm just poking in the dark...
Anyone know what's wrong here?
GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)
Code:
#!/bin/bash
FILES="myfolder"
for i in "$(find "$FILES" -name '*.*')"; do
#echo "$i"
sed -n '/invoke/ {
s/.*->\(.*\)/\1/
s/(.*//
p
}' < "$i" >> output.txt
done
Code:
$ ls -R
file$1.txt new folder
./new folder:
file$2.txt
Error is:
Code:
./sed-invokes.sh: line 6: myfolder/file$1.txt
myfolder/new folder/file$2.txt: No such file or directory
If i run 'echo "$i"' in the loop it shows the files properly.
Code:
myfolder/file$1.txt
myfolder/new folder/file$2.txt