Apr 27, 2004 #1 ranjit Technical User Joined Apr 14, 2000 Messages 131 Location GB What is the best way to awk out the line of text between <> Input file: DataLine756<TRANS:6707,Bank of America,INV.7868467>#L$T Desired output: TRANS:6707,Bank of America,INV.7868467
What is the best way to awk out the line of text between <> Input file: DataLine756<TRANS:6707,Bank of America,INV.7868467>#L$T Desired output: TRANS:6707,Bank of America,INV.7868467
Apr 27, 2004 #2 CaKiwi Programmer Joined Apr 8, 2001 Messages 1,294 Location US Try { sub(/^[^<]*</,"") sub(/>.*$/,"") print } CaKiwi Upvote 0 Downvote
Apr 27, 2004 #3 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US Code: BEGIN { FS="(<)|(>)" } { for (i=0; i<=NF; i=i+2) print $i } vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
Code: BEGIN { FS="(<)|(>)" } { for (i=0; i<=NF; i=i+2) print $i } vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 27, 2004 #4 fjchia Technical User Joined Feb 8, 2004 Messages 7 Location US Or try awk -F"[<>]" '{ print $2 }' Upvote 0 Downvote
Apr 27, 2004 #5 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US don't forget [bold]multiples[/b] vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
don't forget [bold]multiples[/b] vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 27, 2004 #6 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR And the sed way: sed -e 's!.*<!!;s!>.*!!' /path/to/input >output Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
And the sed way: sed -e 's!.*<!!;s!>.*!!' /path/to/input >output Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884