View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-29-2003, 06:28 PM   #1
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Rep: Reputation: 47
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?
Old 11-29-2003, 06:49 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
Try this:
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.
Old 11-29-2003, 11:24 PM   #3
Senior Member
Registered: Aug 2003
Location: Portland, Oregon
Distribution: Gentoo
Posts: 1,372

Original Poster
Rep: Reputation: 47
thank you, but I actially made a shell script to do it for me.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch Processing ankan Linux - Software 3 10-11-2013 11:52 AM
Data Processing joelhop Linux - General 8 01-01-2006 09:08 PM
text processing, maintaining a log jonhewer Linux - Newbie 9 08-25-2005 03:24 AM
input text file processing the gnu way? zero79 Programming 3 03-04-2005 08:41 PM
text processing Gantrep Linux - General 4 02-17-2003 11:37 PM

All times are GMT -5. The time now is 02:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration