so if I understand this the first three fields are skipped and the 4-6 are printed separated by a tab and since the first three fields are skipped so is the trailing tab in the 3rd field?
This skips row 1 and prints after field 3 then loops through 4-6 printing them. I think $(i-3)=$i tells awk to loop through each line and the NF-=3 prints fields 4-6 and then the header is added?
I guess my question is in the first awk how does the header row get added?
Both commands work great, just trying to understand. Thank you .
At work, when I issue:
lpr -P$PRINTER -h filename
the file always prints a line then does a vertical tab off that first line instead of starting the new line at left.
It does this with every file I've tried, and I can't find any options that are set that would make things print this way.
I... (2 Replies)
friends, i am a newbie in scripting. could someone help me in selecting only the last column of below ps command output ?
mqm 14 16466 0 Sep 15 ? 0:01 /opt/mqm/bin/runmqlsr -r -m QMGR.INBOUNDSSL -t TCP -p 1415 -i 5.1.26.5
mqm 12 16700 0 Sep 15 ? 0:00... (4 Replies)
Dear All,
Good Day. I would like to hear your suggestions for the following problem:
I have a file with 5 columns with some numbers in 16 lines as shown below.
Input file:
Col 1 Col 2 Col 3 Col 4 Col 5
12 220 2 121 20
234 30 22 9... (3 Replies)
Dear friends,
I want to print variables' values in certain format where space between two values of variables is "a tab"
I tried where I provided "tab" between two varibales.
But when it print values on screen its giving me output without spaces in two values.
Request you to help me in... (7 Replies)
I have the following script that renames filenames like:
blah_bleh_91_2011-09-26_00.05.43AM.xls
and transforms it in:
91_20110926_000543_3_blih.xls
for a in *.xls;
do
b="$(echo "${a}" | cut -d '_' -f4)"
dia=`echo ${b} | cut -c9-10`
mes=`echo ${b} | cut -c6-7`
anio=`echo ${b} | cut -c1-4`... (4 Replies)
Hi,
I need to search for a word using Awk and print out the line the word is in and every line after the search phrase until I hit this #------------. Then I need to send it to a csv file.
So basically the input file format is like this:... (1 Reply)
I am just trying to output the below awk separated by tabs. Thank you :).
awk (added OFS as an attempt to itroduce tabs)
awk '{split($5,a,"-"); OFS='\t' print $1,$2,$3,a}' file.bed > test.bed
The awk runs and produces all the data in 1 field instead of 4 fields.
current output
... (2 Replies)
In the below awk the output is space delimited, but it should be tab delimited. Did I not add the correct -F and OFS? Thank you :).
The input file are rather large so I did not include them, but they are tab-delimeted files as well.
awk
awk -F'\t' -v OFS='\t' 'FNR==1 { next }
> ... (2 Replies)
In the below awk written by @RavinderSingh13 I have added a few lines and am trying to have the output be tab-delimited. The input is space-delimeted and the portion in bold seems to add a tab to the Not found but not the found. Thank you :).
file1
One 1
Two 2
Three 3
file2
One 1... (2 Replies)
Hi
I have a file profile.txt with the below input:
{"atgUserId":"736f14c4-eda2-4531-9d40-9de4d6d1fb0f","firstName":"donna","lastName":"biehler","email":"schoolathome42@live.com","receiveEmail":"y
es"},
{"atgUserId":"c3716baf-9bf8-42da-8a44-a13fff68d20f","firstName":"Gilberto... (6 Replies)