renaming text files based upon a pattern in their content
How would I go about accomplishing the following?
1. Read a file looking for a particular pattern. i.e footest:
2. Skip the next several blank spaces (the # of which is variable) until the runjob name. i.e. foojobname
3. Rename the file based upon the runjob name and date/time of file
4. Repeat for all files in the directory
I know I can use grep to search through the files but don't know what tool(s) I can use to skip blanks and capture just the 8 char job name from the middle of the line. Would I have to store the jobname into a variable or can I pipe the output of grep directly into say mv to do the renaming?
Thanks for any assistance
|