Ask a Question related to Linux / Unix Administration, Design and Development.
-
Stefaan A Eeckels #1
Re: Awk help backspace
On 28 Mar 2004 14:15:11 -0800
[email]sura_12@yahoo.com[/email] (Raja) wrote:
Did you perchance forget to sacrifice a chicken? You need> Why is my program not working?
to do that if you want to get perls out of awk ;-)
What an utterly weird idea. Do you absolutely have to do that?> Earlier the data file was delimited
> with "|"(Pipe) and the program worked. But now we changed the
> delimiter to X and a backspace character.
\b works in Perl, not in awk. Make sure your backspace> I have tried this by
> replacing the "|" in my programm as follows and it does not work. Any
> help would be greatly appreciated.
has been correctly entered in the script, and isn't a
sequence of two characters, which is why I suggest putting
it in a file, rather than inline:
$ cat stuff.awk
BEGIN { FS = "X^H" }
{
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
}
$ awk -f stuff.awk test.txt
If you're using vi, the sequence control-V control-H will generate
a backspace (010) character, represented by the sequence ^H.
Note that "awk" on Solaris (but not "nawk") will consider any X not
followed by a backspace as a separator. Don't use awk when you're
on a Solaris box.
Take care,
--
Stefaan
--
"What is stated clearly conceives easily." -- Inspired sales droid
Stefaan A Eeckels Guest
-
Ctrl+Backspace?
I miss being able to press Ctrl+Backspace to delete one word to the left. Is it possible to set this in ID CS? -
Unusual behavior for Shift + Backspace
I have to type a lot of capitalized acronyms in my work. When I make a mistake and hit the Backspace key (while still holding down the Shift key),... -
diable backspace key's Browser control
I have a html page with a SWF file. The SWF uses Anchors for the user to utilize the browser functions (back & forward). I have input text fields... -
backspace and delete keys using SSH
I'm having an annoying problem using F-Secure SSH on an AIX 4.3.3 machine. When logged in via SSH the backspace key doesn't erase the character...



Reply With Quote

