Awk help backspace
From: Raja (sura_12_at_yahoo.com)
Date: 03/29/04
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: How to make different targets with make"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Mar 2004 14:15:11 -0800
Why is my program not working? Earlier the data file was delimited
with "|"(Pipe) and the program worked. But now we changed the
delimiter to X and a backspace character. I have tried this by
replacing the "|" in my programm as follows and it does not work. Any
help would be greatly appreciated.
Regards,
Raja
********************************************************
awk -F"X\b" '{
if ( NF < 6 ){
newline=$0
oldline = newline
getline
newline = substr(oldline,1,length(oldline))";" $0
while (substr(newline,length(newline),1) != "X^H"){
oldline = newline
getline
newline = substr(oldline,1,length(oldline))";" $0
}
print newline
next
}
else print $0
}' test.txt
**************************************************
Earlier version with pipes which worked
-----------------------------------------
awk -F"|" '{
if ( NF < 6 ){
newline=$0
oldline = newline
getline
newline = substr(oldline,1,length(oldline))";" $0
while (substr(newline,length(newline),1) != "|"{
oldline = newline
getline
newline = substr(oldline,1,length(oldline))";" $0
}
print newline
next
}
else print $0
}' test.txt
--------------------------------------------
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: How to make different targets with make"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|