08-20-2012
May I suggest two corrections:
($1=="B") should become ($i=="B") to really test every single column and
i< NF should become i<= NF to find the "B" even if it were the last item in the line. You also might want to print a blank to separate adjacent columns.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I would like to know value for previous row, in addition to current row.
How would I will get value for previous row? How can I perform this with awk? (2 Replies)
Discussion started by: videsh77
2 Replies
2. Shell Programming and Scripting
I want to get value of last row and 6 column from awk. Below is the format of my file. And RED one is my desired value. Actaully this stats usally update after every 1 hour so i want that every time i run the script i get the latest value.
Ending time - 01:00:58
HOURLY CALL ATTEMPTS... (4 Replies)
Discussion started by: wakhan
4 Replies
3. Shell Programming and Scripting
Hi
I've file1 as:
after I read all rows with awk, I need to change some of them.
I mean, for example if the last row is zero then change row number 4 in zero too.
So I'd like to refers each row as a vector and change its value accordly some conditions. I know that NR keep just the "current"... (2 Replies)
Discussion started by: Dedalus
2 Replies
4. Shell Programming and Scripting
I want to write a scrpit to merge files row wise (actually concatinating)
main.txt
X Y Z
file 1
A B C
file 2
1 2 3
now i want the script to check if the file1 is empty or not, if empty then make it like
A B C
1 2 3
again to check if second file is empty if not do as done... (0 Replies)
Discussion started by: shashi792
0 Replies
5. Shell Programming and Scripting
Hi Friends,
I have a single column data like below.
1
2
3
4
5
I need the output like below.
0
1
2
3
4
where each row (including first row) subtracting from first row and the result should print below like the way shown in output file.
Thanks
Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies
6. Shell Programming and Scripting
Hi
I need to convert some columns form a html file to rows.
I do manage to make it works without help (some proud :) )
For some reason the offline status is not in bold, so I do need to remove the <b> tag from the other field to make this to work. All fields are not needed, so I test and... (5 Replies)
Discussion started by: Jotne
5 Replies
7. UNIX for Dummies Questions & Answers
file with this content
awk 'NR==1 {print $4} && NR==2 {print $5}' file
The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies
8. Shell Programming and Scripting
How do i print the last record of a group in a file ?
For example, I have a file like this :
cat txt
cucm1,location1,1,2,3
cucm2,location1,3,4,5
cucm1,location1,10,20,30
cucm2,location2,30,40,50
I am expecting a command that would print the last record of the group.
For example, ... (2 Replies)
Discussion started by: Lakshmikumari
2 Replies
9. Shell Programming and Scripting
I would like to find the first matching row and continue to search from the matching row. if column3 equal to 1 in the row, find the next matching row based on the criteria below. column3 in the matching row equal to 0 and column2 equal to column2 in the matching row
test.csv - test data
... (7 Replies)
Discussion started by: chailee
7 Replies
10. Shell Programming and Scripting
how can i sort the table based on first row? thanks in advance
input
name d b c a
l l1 l2 l3 l4
l1 1 2 3 4
l2 2 2 2 1
l3 1 1 2 2ouput
name a b c d
l1 l4 ... (4 Replies)
Discussion started by: quincyjones
4 Replies