03-11-2008
thanks for the rapid answer!
i'm not entirely sure why sed is slow, its either because the search takes longer, or because it writes a lot of data, as you stated. i already tried the address parameter passing the line number, it doesn't help much, so i guess it's indeed the fact that it writes the whole file back to the disk.
i just did a quick test where i read the byte offset from grep, fseek to the position, read the rest from there, do the replace and write the result back to the same offset. the whole process took 25ms. however it's not bash
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hello,
i have changed a slow server with Solaris 7 to a bigger one with
Solaris 8 (Sun Ultra 2). Now i have a real bad performance
problem (only CPU).
Solaris 7 ran with standard FTP and Samba 2.0.7.
The new machine is running ProFTP and Samba 2.0.9.
There are a lot of NFS Shares and... (5 Replies)
Discussion started by: olso
5 Replies
2. UNIX for Advanced & Expert Users
Hi,
1-in vmstat commande line, in reply, which column is the more important to look and verify if server is very slow ?
2-how can I see how many sessions are opened with the same login ?
Many thanks before. (2 Replies)
Discussion started by: big123456
2 Replies
3. UNIX for Advanced & Expert Users
Hi,
I have this on a AIX UNIX machine :
ps aux| head -20
USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
root 516 23.7 0.0 12 15808 - A 19:38:15 903:13 wait
root 774 23.7 0.0 12 15808 - A 19:38:15 902:13 wait
root 1290 23.6 0.0 ... (2 Replies)
Discussion started by: big123456
2 Replies
4. UNIX for Advanced & Expert Users
i want to determine I/O performance of an
executable,
but iostat dont give correct results because
the disk that i am writing to and reading from,
are not physical disk of the host machine,
instead of these local disks we are using
a network storage.
is there any standard way in unix to get... (2 Replies)
Discussion started by: gfhgfnhhn
2 Replies
5. News, Links, Events and Announcements
About 4 years ago I wrote this tool inspired by Rob Urban's collect tool for DEC's Tru64 Unix. What makes this tool as different as collect was in its day is its ability to run at a low overhead and collect tons of stuff. I've expanded the general concept and even include data not available in... (0 Replies)
Discussion started by: MarkSeger
0 Replies
6. Solaris
Hi all,
I have two storadge 3510 Fc .. with 12 disks 146Gb ..total 1752Gb each storadge. I need to use about 1.4 Tb of it. and want RAID1 ..
I need 13 mount points ..
So question:
for best performance and redundjancy how I must do it.
create 13 logical drives on each stordge with same size... (1 Reply)
Discussion started by: samar
1 Replies
7. Shell Programming and Scripting
I'm using sed to do find and replace. But since the file is huge and i have more than 1000 files to be searched, the script is taking a lot of time. Can somebody help me with a better sed command. Below is the details.
Input:
1
1
2
3
3
4
5
5
Here I know the file is sorted.
... (4 Replies)
Discussion started by: gpaulose
4 Replies
8. Shell Programming and Scripting
I'm searching the most effective way of doing the following task, so if someone can either provide a working solution with sed or one totally different but more effective then what I've got so far then please go ahead!
The debugme directory has 3 subdirectorys and each of them has one .txt file... (7 Replies)
Discussion started by: TehOne
7 Replies
9. UNIX for Dummies Questions & Answers
Hi Guys,
I've wondered for some time the performance analysis between using sed and awk. say i want to print lines from a very large file. For ex say a file with 100,000 records. i want to print the lines 25,000 to 26,000 i can do so by the following commands:
sed -n '25000,26000 p'... (11 Replies)
Discussion started by: Irishboy24
11 Replies
LEARN ABOUT LINUX
shtool-subst
SHTOOL-SUBST.TMP(1) GNU Portable Shell Tool SHTOOL-SUBST.TMP(1)
NAME
shtool-subst - GNU shtool sed(1) substitution operations
SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext]
[-e|--exec cmd] [-f|--file cmd-file] [file] [file ...]
DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files.
OPTIONS
The following command line options are available.
-v, --verbose
Display some processing information.
-t, --trace
Enable the output of the essential shell commands which are executed.
-n, --nop
No operation mode. Actual execution of the essential shell commands which would be executed is suppressed.
-w, --warning
Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution
operations resulted in no content change on all files.
-q, --quiet
Suppress warning on substitution operation resulting in no content change.
-s, --stealth
Stealth operation. Preserve timestamp on file.
-i, --interactive
Enter interactive mode where the user has to approve each operation.
-b, --backup ext
Preserve backup of original file using file name extension ext. Default is to overwrite the original file.
-e, --exec cmd
Specify sed(1) command directly.
-f, --file cmd-file
Read sed(1) command from file.
EXAMPLE
# shell script
shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch]
# RPM spec-file
%install
shtool subst -v -n
-e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g'
-e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g'
`find . -name Makefile -print`
make install
HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted
by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications.
SEE ALSO
shtool(1), sed(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)