Of course it "stalls", it has to read 9 whole gigs of data before it can do anything else and tries to keep the entire 500,000 lines of data in memory at once. Processing 9 gigs of data is going to take a while no matter how you cut it, and it won't find the data it wants until it's nearly done. To get the last 500,000 lines, it has to figure out where the end is, then back up from there...
Some implementations of 'tac' however, work by seeking, which would avoid having to read the first 99% of the file. It'd deliver them in reverse order so you could just head to get the number of lines you want, then reverse it again. I'm not sure Sun's does, but it's worth a shot:
If Sun's tac doesn't do that, maybe you can install GNU tac.
Last edited by Corona688; 05-29-2012 at 01:00 PM..
If your file is of fixed length (meaning that each line has the same length), then you can seek to the position of the target line and read the desired number lines.
Hi,
I have file with all the lines as following format
<namebindings:StringNameSpaceBinding xmi:id="StringNameSpaceBinding" name="ENV_CONFIG_PATH" nameInNameSpace="COMP/HOD/MYSTR/BACKOFFICE/ENV_CONFIG_PATH" stringToBind="test"/>
I want to replace (all the lines) value of... (8 Replies)
Hi all,
I want to edit nth filed of a comma delimited line with some value. Can I use sed command to do this.
Pls suggest me the command here.
Thanks,
Poova. (2 Replies)
Hello,
I am attempting to create a command that I can eventually put into a loop so I can edit 1file on many servers. I would like to edit the file in place with sed -i. If not I will take any suggestions on how to use a temp file. I need to remove a email address from the configuration file... (4 Replies)
What is an efficient way to remove all lines from the input file which contain a file name?
inputfile:
=======================
# comment
# comment
# comment
5 8 10 /tmp
5 8 10 /var/run
5 8 10 /etc/vfstab
5 8 9 /var/tmp
5 8 10 /var/adm/messages... (7 Replies)
Hi
I want to repalce a field in a txt file on solaris with say 100 records and each record having a total of 10 fields separated by a ~ .
based on the following condition the record should be edited or else the record should be written as it is to a
if the seventh field is 'XX' and if... (2 Replies)
I have the follwoing file:
This looks to be : seperated.
For the first field i want only the file name without ".txt" and also i want to remove "+" sign if the second field starts with "+" sign.
Input file:
Output file:
Appreciate your help (9 Replies)
Hi, I'm a newbie to sed and I'm having trouble working with sed and fields.
Suppose I have a text file with:
AAA RFG:$2.10:6:25Oct06
WDD GGTR:$3.50:5:25Oct06
ADDSJ OO:$1.37:3:26Oct07
UGBDN S:$4.73:1:27Oct06
USY ADC:$2.38:20:27Oct06
And I want to substitute field 2 of line 3 with, say,... (3 Replies)
Could someone please tell me how to delete all lines above a line which contains a particular string? (possibly using SED command)
I know how to do this if the target string appears in only one line of file but when it appears in multiple lines it only deletes from the first line which the string... (3 Replies)
I have output like the following:
B D 20070116095820001 N D S0000579.LOG S0000582.LOG
B D 20070116095750001 N D S0000574.LOG S0000576.LOG
B D 20070116095734001 N D S0000570.LOG S0000573.LOG
B D 20070116095705001 N D S0000569.LOG S0000569.LOG
B D ... (5 Replies)
Hi,
I generally use Perl for this
ex.
perl -e 's/pattern/replace/g' -p -i <filename>
I did something like this..
find . -type f -exec perl -e 's/pattern/replace/g' -p -i {} \;
I want to do this with "sed"
but what I get is the output being printed on the screen..
i can do sed... (3 Replies)