Howdy, I'm a total newbie to scripting and I can't figure out the proper syntax to shell script a for loop for the following scenario: I have a directory of symbolic links to backup log files. I want to loop through the dir to cat the last 21 lines of each file and put all the output to another file. I can't seem to get the loop to do what I want no matter how many different iterations of cat list | tail -21 etc. I try. I've looked through all my available books and on the web but so far no luck in finding just the right combo. Many thanks in advance for any help.
bmead
0
Newbie Poster
Recommended Answers
Jump to Posttry it, post it, and we will help to correct it
Jump to PostFirst off, which "shell" are you talking about?
There are many varieties (sh, bash, ksh, csh) and syntax varies.Maybe
for i in `cat list`; do tail -21 $i; done
All 6 Replies
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
Salem
5,138
Posting Sage
JeoSaurus
32
Posting Whiz in Training
bmead
0
Newbie Poster
Salem
5,138
Posting Sage
bmead
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.