Ive got a file with words and also numbers.
Bla BLA
10 10
11 29
12 89
13 35
And i need to change "10,29,89,25" and also remove anything that contains actually words A-Z.
Got it this far:
awk '$2 > 0 {$2=20;}{print}' file
works good to change the second line to 20, however the answe is going into a DB so i need to remove "Bla and BLA from the outout, the answer.
I am guessing the answer should be something like:
awk '$2 > 0 && -ne [A-Z] {$2=20;}{print}' file
awk ' $2 ~ "^[0-9]+$" && $2 > 0 {$2=20;print} ' filename
This seems to work so far:
awk ' /[0-9]/ {print} ' file | awk '$2 > 0 {$2=20;}{print}'
However the file also contains words in the end of the file.
Bla BLA
10 11
11 25
12 30
13 25
Bla,bla,bla,bla,bla
Ouput now looks like this now:
10 20
11 20
12 20
13 20
Bla,bla,bla,bla,bla
But still got the last line to remove.
Thank you for the answer.
It seems to work but to the actually file....
I get no output at all to the actually file but if i do a file like the example it works..
The actually file looks like this:
"OL_ID OL_LINK_COST
----------- ------------
51 10
52 10
53 10
54 10
55 10
56 10
57 10
58 10
59 10
60 10
61 10
62 20
63 10
64 10
65 10
66 10
67 10
68 10
69 10
70 10
71 10
72 10
73 10
74 10
75 10
76 20
77 10
78 10
93 20
94 20
95 20
96 20
97 20
98 20
99 20
100 20
101 10
102 20
103 20
104 20
105 20
106 20
107 20
108 20
109 20
110 20
111 20
112 10
113 20
114 20
126 10
127 20
128 10
129 20
54 record(s) selected."
Thank you Anbu23
It helped me, alot!
awk ' $2 ~ "^[0-9]" && $2 > 0 {$2=20;print} ' file
This worked when i removed +$