Home > other >  Regular expression replace under Linux bash
Regular expression replace under Linux bash

Time:10-02

I have a TXT text as follows, the inside of the need to replace the mode in a column, you need to 5-12345-01-001-001 with 5-12345-01, also is to the back of the as - 001-001, 003-003-015-015, (mode is: '- (\ d +) repeat twice), feeling through the sed command can be implemented, but also not understand, please tall person to give directions, thank you!

5-12345-01-001-001-1 99 5
4.85-12345-01-52.84 1, 99, 11, 003-003
5-12345-01-201.26 1, 99, 27, 001-001
5-12345-01-001-37 15 001 29.85 1
5-12345-01-66.82 1, 92, 11, 001-001
5-12345-01-001-001 174.08 1 52 7
5-12345-01-4.3 2, 71, 001-001
5-12345-01-36.62 2, 99, 13, 001-001
5-12345-01-003-003 20.11 99 16
5-12345-01-001-001 1.23 3 99 26
5-12345-01-65.51 3, 99, 11, 001-001
5-12345-01-25.98 3, 99, 001-001
5-12345-01-001-001 20.06 4, 53 23
5-12345-01-001-001 77.55 4, 99, 27
5-12345-01-001-001 22.59 5 55 4
5-12345-01-29.1 6 and 11, 001-001
5-12345-01-35.55 6 and 8, 001-001
5-12345-01-146.41 6, 99, 001-001
5-12345-01-001-001 0.11 6 31 19
5-12345-01-001-58.12 7 99 21 001
5-12345-01-39.54 7, 99, 001-001
5-12345-02-13.55 7 and 4, 003-004
5-12345-01-78.39 7 and 32, 015-015
5-12345-01-001-001-9.6 July 27 99
  • Related