if there is just a single character as field separator:
--
@ jotne, if printf is used without explicitly specifying the format field than this is left to the input data.. Try replacing one of the fields with "%s" for example
Last edited by Scrutinizer; 01-06-2013 at 06:17 AM..
These 2 Users Gave Thanks to Scrutinizer For This Post:
Hi to all! I 'm new in unix programing so... may be I decided a wrong tool to solve the problem but anyway... all road goes to rome jajaja.
My question is: There is any way to print date at the END clause of an AWK script. I mean, I'm writing a tool with AWK and the results are redirected to a... (4 Replies)
Team,
Could some one help me in Printing from matching word to end using awk
For ex:
Input:
I am tester for now
I am tester yesterday
I am tester tomorrow
O/p
tester for now
tester yesterday
tester tomorrow
i.e Starting from tester till end of sentence (5 Replies)
Hi
I am trying to search and replace a multi line pattern in a php file using awk.
The pattern starts with
<div id="navbar">
and ends with
</div>
and spans over an unknown number of lines.
I need the command to be a one liner.
I use the "record separator" like this :
awk -v... (8 Replies)
I would like to print result of multiple search pattern invoked from an one liner. The code looks like this but won't work
gawk -F '{{if ($0 ~ /pattern1/) pat1=$1 && if ($0 ~ /pattern2/) pat2=$2} ; print pat1, pat2}'
Can anybody help getting the right code? (10 Replies)
Thanks for giving your time and effort to answer questions and helping newbies like me understand awk.
I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk.
Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Hi!
I have a strange behaviour from sed and awk, but I'm not sure, if I'm doing something wrong:
I have a list of words, where I want to add the following string at the end of each line:
\;\;\;\;0\;1
I try like this:
$ cat myfile | awk '{if ( $0 != "" ) print $0"\;\;\;\;0\;1"}'
Result:... (5 Replies)
Hi,
OS = Solaris
Can anyone advise if there is a one liner to print specific output from a df -k output?
Running df from a command line, it sometimes gives me 2 lines for some volume. By re-directing the output to a file, it always gives 1 line for each.
Below is an example output,... (4 Replies)
im trying to get
awk to print the string between 3rd and 4th backslashs to end of line
test could be any word
this
http://example.com/test/ >to this
http://example.com/test/ > testalso the other way round insert string at end of line... (13 Replies)
In the below perl I am trying to extract and print the values AF1=, the GT value, and F or QUAL diveded by 33 (rounded to the nearest whole #). The GT value is at the end after the GT:PL so all the possibilities are read into a hash h, then depending on the value that is in the line the... (1 Reply)