LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   text editingor processing (https://www.linuxquestions.org/questions/linux-general-1/text-editingor-processing-121078/)

exodist 11-29-2003 05:28 PM

text editingor processing
 
I have about 1500 text files (seperate files) each starts with " (PICTURE)" on the first line, then everythign else is on lines below it. is there a command or script I can use/make to go into each of these files and remove that first line?

david_ross 11-29-2003 05:49 PM

Try this:
Code:

IFS="
"
for file in `find /path/to/files`;do tail -n $((`grep -c "" $file`-1)) $file > /tmp/tempfile;mv /tmp/tempfile $file;done

NOTE: This will remove the first line from any file returned by the find command! If you cannot create a find pattern to only match the files you want to edit I would add an if statement to look for your pattern on the first line of every file.

exodist 11-29-2003 10:24 PM

thank you, but I actially made a shell script to do it for me.


All times are GMT -5. The time now is 08:21 PM.