Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -ne 2 ]
- then
- echo "USAGE: `basename $0` source_folder some_name.txt"
- exit 1
- fi
- FROM=$1
- result=$2
- #recursively list even the deepest documents in the argument#1 folder, then leave only the names of the .txt files that include a \n1n2n3n4\ pattern
- files=`ls -R $FROM | grep ^- | awk 'print $9' | grep \'\'[0-9][0-9][0-9][0-9]\'\'.*\.txt$`
- for f in $files
- do
- #get the 4 digit number in the file's name and print the file's insides in the argument#2 file
- digitcode=` echo $f | awk -F'\' {print $2}`
- echo "============= $digitcode ============="
- echo "cat ${FROM}${f}" >> $result
- echo "============= $digitcode ============="
- done
- cat $result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement