Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Replace values

$
0
0
Gents,

Can you please help with this.

Input file
Code:

49955 2009 2
49957 2010 2
49959 2010 2
49961 2010 2
49963 2010 2
49789 2011 -174
49791 2011 2
49793 2011 2
49795 2011 2
49965 2011 170
49967 2011 2
49969 2011 2
49971 2011 2
49797 2012 -174
49799 2012 2
49801 2012 2
49803 2012 2
49973 2012 170
49975 2012 2
49977 2012 2
49979 2012 2

output desired.
Code:

49955 2009 V2
49957 2010 V2
49959 2010 V2
49961 2010 V2
49963 2010 V2
49789 2011 V3
49791 2011 V3
49793 2011 V3
49795 2011 V3
49965 2011 V2
49967 2011 V2
49969 2011 V2
49971 2011 V2
49797 2012 V3
49799 2012 V3
49801 2012 V3
49803 2012 V3
49973 2012 V2
49975 2012 V2
49977 2012 V2
49979 2012 V2

I would like to replace values in column 3 with values V2 and V3, as example of output file, When the value in column 3 = -174, need to replace to V3 and also the next 3 rows.

Thanks

Viewing all articles
Browse latest Browse all 16232

Trending Articles