I recently needed to remove a bunch of spaces and needed to compress some data down and found that tr -s was exactly what I needed.
more taxref
6212301245700000123456 00000588005617512580 JOHN SMITH 0042158657802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042198757802577
6212301245700000123456 00000600005617512580 SHARON JONES 0042198757802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042158657802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042198757802577
6212301245700000123456 00000600005617512580 SHARON JONES 0042198757802577
tr -s " " >newtax
more newtax
6212301245700000123456 00000588005617512580 JOHN SMITH 0042158657802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042198757802577
6212301245700000123456 00000600005617512580 SHARON JONES 0042198757802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042158657802577
6212301245700000123456 00000588005617512580 JOHN SMITH 0042198757802577
6212301245700000123456 00000600005617512580 SHARON JONES 0042198757802577
Although this may not be exactly what you need it certainly helped me compress down some data and get ride of a lot of extraneous spaces.
No comments:
Post a Comment