Removing special chars from file and maintain field separator
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.
The command I'm using is as follows :
This produces following output:
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.
Replace this
by
Make sure the leading single quote is there. Drop the -n option and the p flag for a test, if the error msgs remains. Or swap the p and the g flags.
Hi Team,
I have a file a1.txt with data as follows.
dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><!
The delimiter string: <SelectStatement modified='1' type='string'><!
dlm="<SelectStatement modified='1' type='string'><!
The above command is... (7 Replies)
Hi all,
I'm using iconv command to change files encoding to UTF-8
If my input file has chars as those are removed creating the file without those special chars.
I tried using iconv -c, but there is still the removal.
Is there a way to keep those special chars changing just the... (6 Replies)
Hi,
I need all your help to achieve the below functionality.
I have a big 2 GB file and inside the file we need to identify, whether having a comma(,) or pipe(|) or tab or fixed position or semicolon(;) delimiter. If any of those delimiter found need to replace the file with pipe(|)... (1 Reply)
Hello,
I have a file with such structure:
>ENSGALG00000000011|ENSGALT00000000012|57|1123|1125
AACTGTGTGTTTTTT
>ENSGALG00000000012|ENSGALT00000000013|57|1145|1155
AAAAAAGGTCCTGTGTGC
>ENSGALG00000000015|ENSGALT00000000014|57|1144|1155
AAAATGTGTGTGTGTGTGTGTG
I want to use another file... (8 Replies)
Hello,
I have a file:
xandyandz
x & y & z
x*y*z*a
I require output as:
zandyandx
z & y & x
a*z*y*x
here all lines have different field seperator (and & * )based on that i want to reverse the column of a file.
Pl. help. (8 Replies)
Dear community,
maybe I'm asking the moon :rolleyes:, but I'm scratching my head to find a solution for it. :wall:
I have a file called query.out (coming from Oracle query), the file is like this:
ADDR TOTAL
-------------------- ----------
TGROUPAGGR... (16 Replies)
I'm trying to move a large folder to an external drive but some files have these weird chars that the external drive won't accept.
Does anyone know any command of any bash script that will look through a given folder and remove any weird chars? (4 Replies)
Hi, all
I need to get fields in a line that are separated by commas, some of the fields are enclosed with double quotes, and they are supposed to be treated as a single field even if there are commas inside the quotes.
sample input:
for this line, 5 fields are supposed to be extracted, they... (8 Replies)
hi thanks a lot
But pls help me if my input file is the below format:
Name priya 2010-09-21 10:43:49
TEXT ID 1
hi
TEXT ID 2
how
TEXT ID 3
r
TEXT ID 4
u
Name2 priya2 2010-09-21 10:43:49
TEXT ID 1
hi1
TEXT ID 2
how1
TEXT ID 3
r1 (4 Replies)
what my code is doing, it is executing a sql file and the resullset of the query is getting stored in the text file in a fixed format. for that fixed format i have used the following code::
Code:
awk -F":"... (2 Replies)