LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-07-2004, 05:35 PM   #1
ththomas
LQ Newbie
 
Registered: Mar 2004
Posts: 1

Rep: Reputation: 0
How to delete the first line of evrer .java file recursively


Hi,

How do I delete the first line of every .java file that exists in the current directory all the subdirectorectories and so on.

Thanks,
tt
 
Old 03-07-2004, 06:36 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
if you're using C/C++ have a look at 'man ftw' or 'man opendir' && 'man readdir'. if not, if google for 'directory traversal algorithms' you'll prolly find plenty of examples.
 
Old 03-08-2004, 08:55 AM   #3
Galik
Member
 
Registered: Mar 2003
Location: UK
Distribution: gentoo
Posts: 67

Rep: Reputation: 15
try typing this at the console. Back up your java files first!!

Code:
for file in `find . -name "*.java"`; do cat $file|sed '1 d' > $file.tmp; mv $file.tmp $file; done
Hope this works...
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unix shell script:How to delete the first line in a file?? rche3252 Programming 6 03-03-2010 07:32 AM
[SOLVED] delete the end of each line in a file with sed angel115 Linux - Newbie 3 11-16-2005 04:41 PM
How do I delete a line in a file with fstream (C++)? CrazyHoboMan Programming 3 08-18-2005 02:06 AM
locate and delete a line from a file eilison Programming 3 05-17-2005 06:07 PM
Delete line from flat text file in C zaichik Programming 6 01-26-2005 06:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:04 AM.

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