It works fine when I try it. Please show us the output from the command:
The sample you have shown us has the character to be changed as the 51st character on the 1st line of hugefile. Your response to my earlier questions said it was the 103rd character on the line. (Of course you also said that your 3GB file has a total length of 106 bytes, so we don't know what to believe.)
Something doesn't add up here, and your refusal to use CODE tags when displaying your sample input and output may be a contributing factor.
I have another script that might work, but it doesn't make any sense posting it if I can't get a sample to use to test it that bears some resemblance to the first few lines of your huge file.
Thanks Don...In my sample file it 51 character and in my original data it 103 character.
Bottom line, it has to be changed from P to T or from T to P. Also as I said file size in Giga bytes. could you please post your other script ? I will give a try.
I will post the current script in my next post
I don't write a lot of interactive awk scripts, but this seems to do what you want (as long as your version of awk supports the nextfile command. If awk on your system doesn't support nextfile and the character you want to change is in a fixed position, Corona688's suggestion (modified to loop across a list of files and to use whatever character position is in your real data (instead of 51 that was in your sample data)) would be a better approach.
The script below uses field 16 (which you refer to as ISA segment 15), no matter what character number that is within a line. If it finds a "P" or a "T", it tells you what it found and asks if you want to change it, otherwise it tells you what it found but does not change anything. In either case, it then moves on to the next file until all files you provided as operands are processed:
It was written and tested using the Korn shell, but will work with any shell that handles POSIX-required variable expansions (such as bash).
If you are trying this on a Solaris system, I don't think it will work. I don't think /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk support nextfile; and /bin/awk or /usr/bin/awk on Solaris systems can't handle this script.
Hi,
I am a newbie to the UNIX world. I am asked to edit the file in hexadecimal format and save it. Later I should be able to print the file in char mode.
please anyone tell me how to do that mostly using VI editor. (1 Reply)
Hi ,
I have a requirement to compare 2 files which can contain 40 million or more records and more than 20 fields to compare .
Currently I am using awk scripting , and since awk has a memory issue, I am not able to process file more than 10 million records.
Any suggestions or pointers to... (7 Replies)
Hi,
Is there a way to edit BINARY files in Unix.
Or even are there any commands (shellscript/perl) through which I can replace all the occurences of a string inside a BINARY file with another string ?? (1 Reply)
I have a big file, which vi opens it with message not sufficient space with file system.
I am not adding any data in the file but changing some values within.
To make these changes effective, it asks for forced write (w!), even after doing this,
I see this particular record, change is not... (4 Replies)
Hi,
Can some one provide me with, some good links containing help for file editing and printing in unix.
Regards,
Muhammad Tayyab
Shereen Motor Co. Kuwait (1 Reply)
1 . Thanks everyone who read the post first.
2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too.
How to view it ?
If I want to view 200-300 ,how can I implement it
3 . Thanks (3 Replies)
i currently am using a unix server and NT pc. i have downloaded a ziped file that should explode into 3 seperate unix based files, however when i unzip it using Alading Expander it displays only 1. This exploded version contains all 3 files ( you can scroll down when viewing the file and see the... (1 Reply)