Hi, trying to make a list, started doing some grep and regex and thought it'd be easier with KM
So, a folder has some XML files:
file1
file2
file3
etc
I'd like to process each file, and get the following for each one:
1. Extract a string inside each file
This grep works in Terminal:
grep -E "name-en([^>]+)"\surl="
2. The number of occurrences of a string in each file
This command works in Terminal:
grep -RIci "</Preset>" . | awk -v FS=":" -v OFS="\t" '{ print $2, $1 }'
So, my goal is to create a file result.txt
with the following content:
name-en-string-result 10 file1
name-en-string-result 8 file2
name-en-string-result 0 file3
name-en-string-result 1 file4
etc