I have a pipe delimited file and I'm trying to write a script that will give the character/byte positions of each pipe in the file. There may be some simple way but I don't know what it is... Can someone help with this?
Ex: file has output below
I want the script to tell the char positions of the pipes:
Moderator's Comments:
Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules.
Last edited by Don Cragun; 12-22-2016 at 08:35 PM..
Reason: Add CODE tags.
I have a pipe delimited file and I'm trying to write a script that will give the character/byte positions of each pipe in the file. There may be some simple way but I don't know what it is... Can someone help with this?
Ex: file has output below
I want the script to tell the char positions of the pipes:
Moderator's Comments:
Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules.
If this is not homework, please explain why you need to do this.
What operating system and shell are you using?
And, please show us what you have tried to solve this on your own (in CODE tags).
Are you looking for byte counts, character counts, or both. Depending on what tools you're using, bytes counts will be easier or harder than character counts. What tools do you intend to use?
I have a fixed-length positional file. I am trying to replace content of position 4-13 (length=10) with xxxxxxxxxx.
Sample 2 rows in this file:
H0187459823 172SMITH, JOE
H0112345678 172DOE, JANE
In this example 87459823 (from 1st line) and 12345678 (from 2nd line) (both in position... (3 Replies)
Hi
I am new to Unix Shell scripting have a requirement where I have to replace the "unix 1 byte delimiter" with the "pipe" separator and also remove any carriage returns and line feeds if any
The Source File
4 QFH Jungle Hill 32-34 City Road London SE23 3UX
the output should be ... (3 Replies)
I have a huge file with lot of rows... with each row around 400 characters.. with spaces as well..
(e.g)
Line1:
"AC254600606 USDMI000001Anom01130073981 0000000000000.002005040720991231 ... (13 Replies)
I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX.
awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile
But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
Hello ,
I need to extract data from specific byte positions of a file.
I have tried the below command
awk ' { printf "%s", substr($0, 642363,642369}' filename
to extract data between byte positions
642363 and 642369 .
However I did not get the expected result.
I am new to awk... (6 Replies)
Hi
i am having text file like this
40000201040005200213072009000000700000050744820906904421
40069300240005200713072009000000067400098543630000920442
i want to replace 9-16 positions of my txt file...by 1234567...in a single line command
i.e
0400052....should be replaced by... (2 Replies)
Hi All
Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE.
Please suggest me something.
Thank's and regards
Vinay (1 Reply)
In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server.
For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match.
Please... (4 Replies)