Guest_imported
New member
- Jan 1, 1970
- 0
HI All,
For example I have a "file" which contains the following,
1 CAT 34
2 CAT 33
3 CAT 88
4 DOG 90
5 DOG 12
6 PIG 34
7 PIG 33
8 PIG 25
9 COW 44
10 COW 45
11 ANT 23
12 ANT 33
Does anyone know how I can bucket the lines containing CAT and save it to one file named cat.txt, the same goes for DOG in dog.txt and for PIG in pig.txt?
I used bigoldbulldog's code below....
#! /usr/bin/awk -f
$2 != "" { print > tolower($2) ".txt" }
but an error message appears which says:
awk : too many output files...
Does anyone know how I can still use the above script to be incorporated on a file with more than 10 entries???
Thanks!
-CGLY
For example I have a "file" which contains the following,
1 CAT 34
2 CAT 33
3 CAT 88
4 DOG 90
5 DOG 12
6 PIG 34
7 PIG 33
8 PIG 25
9 COW 44
10 COW 45
11 ANT 23
12 ANT 33
Does anyone know how I can bucket the lines containing CAT and save it to one file named cat.txt, the same goes for DOG in dog.txt and for PIG in pig.txt?
I used bigoldbulldog's code below....
#! /usr/bin/awk -f
$2 != "" { print > tolower($2) ".txt" }
but an error message appears which says:
awk : too many output files...
Does anyone know how I can still use the above script to be incorporated on a file with more than 10 entries???
Thanks!
-CGLY