|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Awk: display all fields but one
Hi all
Just say you have a line containing 50 delimited fields. Is there a quick way I could tell awk not to display field $13? Example: 1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/... Result: 1/2/3/4/5/6/7/8/9/10/11/12/14/15/16/17/18/19/20/... The content of the field in question is not known. Cheers |
|
#2
|
||||
|
||||
|
Try this:
Code:
awk -F/ '{
for (i = 1; i < NF; i++) {
if (i != 13) {
printf "%s/", $i;
}
}
printf "\n";
}' /path/to/file
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Awk: display all fields but one |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|