Results 1 to 4 of 4
Hello my friends,I'm a new learner to programming in Linux so kindly can you help me to write this simple script for me and it is lists all text files ...
- 08-16-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 6
Find and write to a files
Hello my friends,I'm a new learner to programming in Linux so kindly can you help me to write this simple script for me and it is lists all text files "*.TXT" in a directory and writes the first line of each text-file to a file called "Aby_Name".
Thank you so much.
- 08-16-2008 #2Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
Code:for f in *.TXT; do awk 'NR==1{print $0}' $f >> Aby_name; done
- 08-17-2008 #3Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
you can also use the head command to do that:
Code:head -1q *.TXT > Aby_Name
- 08-17-2008 #4Just Joined!
- Join Date
- Aug 2008
- Posts
- 6
Thank you so mush


Reply With Quote