Running SunOs 5.6. Solaris.
I've been able to remove all special characters from a fixed length file which appear in the first column but as a result all subsequent columns have shifted to the left by the amount of characters deleted.
It is a space separated file. Line 1 in input file is corrupt. Line 2 is what it should look like. The string 000022000362700 starts at position 49 on both lines. The problem I'm having is that after removing the 3 special chars the field moves to position 46.
Line 1
GAVISCON LIQUID PEPPERMINT �OT 000022000362700 159588000007979400 50001584182 0006S020000
Line 2
GAVISCON LIQUID PEPPERMINT OT 000022000362700 159588000007979400 50001584182 0006S020000
The command I'm using is as follows :
This produces following output:
GAVISCON LIQUID PEPPERMINT OT 000022000362700 159588000007979400 50001584182 0006S020000
By removing the special characters every field to the right of the changed field has moved to the left changing the field start positions.
It appears that the line of text is not showing the correct character spacing but all fields from the first numeric field onwards should have the same starting position.
I've been searching for a while now and cannot find any solution for this issue.
How should I proceed?
I've been able to remove all special characters from a fixed length file which appear in the first column but as a result all subsequent columns have shifted to the left by the amount of characters deleted.
It is a space separated file. Line 1 in input file is corrupt. Line 2 is what it should look like. The string 000022000362700 starts at position 49 on both lines. The problem I'm having is that after removing the 3 special chars the field moves to position 46.
Line 1
GAVISCON LIQUID PEPPERMINT �OT 000022000362700 159588000007979400 50001584182 0006S020000
Line 2
GAVISCON LIQUID PEPPERMINT OT 000022000362700 159588000007979400 50001584182 0006S020000
The command I'm using is as follows :
Code:
cat file.txt | grep '[^ -~]' | sed 's/[^ -~]//g'
GAVISCON LIQUID PEPPERMINT OT 000022000362700 159588000007979400 50001584182 0006S020000
By removing the special characters every field to the right of the changed field has moved to the left changing the field start positions.
It appears that the line of text is not showing the correct character spacing but all fields from the first numeric field onwards should have the same starting position.
I've been searching for a while now and cannot find any solution for this issue.
How should I proceed?