Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SHELL script to parse comma delimited text file

 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, managed to get started.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic