jQuery in Action, 2nd edition*
The moose likes Linux / UNIX and the fly likes SHELL script to parse comma delimited text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "SHELL script to parse comma delimited text file" Watch "SHELL script to parse comma delimited text file" New topic
Author

SHELL script to parse comma delimited text file

Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
I've a text file with contents like this:


I need a SHELL script to read this text file, line-by-line. The 1st field is a folder name, the next 2 fields are number of days.

For each folder, the script would compare if see if any files are older than 10 days, if so, delete them.

Any help to get started is much appreciated!


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
Investigate the commands sed and awk. There is, as a matter fo fact, a very good book about the two of them by O'Reilly.
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Thanks, managed to get started.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SHELL script to parse comma delimited text file