Replace values in column, space delimited file in Vim

Posted by user1256923 on Super User See other posts from Super User or by user1256923
Published on 2014-08-19T16:22:00Z Indexed on 2014/08/20 4:24 UTC
Read the original article Hit count: 159

Filed under:

I have a file that looks like:

2067 24311 <hkxhk> {00}
2069 17219 <hkxhk> {00}
2071 20931 <hkxhk> {00}
2073 5557  <hkxhk> {00}
2075 2127  <hkxhk> {00}
2077 20947 <hkxhk> {00}
2081 18088 <hkxhk> {00}

I want to replace the first column value so that it looks like

5 24311 <hkxhk> {00}
5 17219 <hkxhk> {00}
5 20931 <hkxhk> {00}
5 5557  <hkxhk> {00}
5 2127  <hkxhk> {00}
5 20947 <hkxhk> {00}
5 18088 <hkxhk> {00}

Where the first space delimited column has been replaced by a new value, in this case 5.

© Super User or respective owner

Related posts about vim