10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
My grep returns a row of data like this:
75=20130130;60=074338;61=985;511=55473883;452=115439;62=196;267=1;
Is there a way for the grep to only return 60="something" and 511="something" ?
Thanks in advance. (10 Replies)
Discussion started by: Carl2013
10 Replies
2. Shell Programming and Scripting
is there anyway i can ask grep to only get the first line?
as in the top command line
line 1 <-- just grep this line
line 2
line 3
---------- Post updated at 04:24 PM ---------- Previous update was at 04:19 PM ----------
nvm.. found out that i can do it with
|head (12 Replies)
Discussion started by: Nick1097
12 Replies
3. Shell Programming and Scripting
can anyone tell me what the \/$ means? from
grep \/$ (8 Replies)
Discussion started by: Nick1097
8 Replies
4. Shell Programming and Scripting
i have files with "DOMAINSOLVER ACMS" with any number of spaces in between the two words on its own line and i can find it with the following:
grep -c "DOMAINSOLVER* ACMS" $FILENAMEbut i need to exclude any lines matching: "$DOMAINSOLVER". i've tried a variety of quoting and escaping with no luck.... (4 Replies)
Discussion started by: crimso
4 Replies
5. Shell Programming and Scripting
Hello,
Is there a way in grep to remember patterns?
For eg: int a,b,c,d,a;
If a variable is declared twice, like in the previous example, I should be able to print only those lines.
Is there a way to print only the lines where the variable name occurs more than once, using grep... (1 Reply)
Discussion started by: prasanna1157
1 Replies
6. UNIX for Dummies Questions & Answers
Instead of using the following command
#dmesg | grep -v sendmail | grep -v xntpd
How can I use just one grep -v and give both arguments.
Please suggest
thanks (4 Replies)
Discussion started by: Tirmazi
4 Replies
7. Shell Programming and Scripting
hello people,
All my servers have 4 mounts with this norme. For example, if my hostname is siroe.
df -h | grep `hostname`
/dev/dsk/c1t3d0s6 404G 399G 800M 100% /siroe3
/dev/dsk/c1t2d0s6 404G 399G 800M 100% /siroe2
/dev/md/dsk/d6 20G 812M 19G ... (3 Replies)
Discussion started by: melanie_pfefer
3 Replies
8. UNIX for Dummies Questions & Answers
Hello Everybody,
I have files; yyyymmdd.log which the data look like this;
"Txid=9426043&MsgTxt=Thankyou&UserId=john&Password=jh2501"
"Txid=9426150&MsgTxt=Thankyou&UserId=john&Password=jh2501"
.
.
.
"Txid=9426200&MsgTxt=Thankyou&UserId=john&Password=jh2501"
Question 1:
How to... (3 Replies)
Discussion started by: nazri76
3 Replies
9. UNIX for Dummies Questions & Answers
I want to search for a word from the root directory using grep command.
I am searching for a word called batch in cd /vol directory.The vol directory has so many sub-directories and I want to see all the files having the name as batch.
This what I tried ..
/vol/ % grep -i *batch*
But it is... (4 Replies)
Discussion started by: ANAMIKA56
4 Replies
10. UNIX for Dummies Questions & Answers
what is the format for grep if I want to search from the current directory and through all its subdirectories?:) (3 Replies)
Discussion started by: pkappaz
3 Replies
edinplace(1) Mail Avenger 0.8.3 edinplace(1)
NAME
edinplace - edit a file in place
SYNOPSIS
edinplace [--error=code] [[--file=file] command [arg ...]]
DESCRIPTION
edinplace runs command with its input from file (or standard input by default), and then replaces the contents of file with the output of
command. To the extent possible, edinplace attempts to exit with the same status as command.
If edinplace is run on standard input (no --file option), it must inherit a file descriptor 0 that is open for both reading and writing.
When processing standard input, if edinplace does not encounter a fatal error, it rewinds its standard input to offset 0 before exiting.
Thus, a script can first run edinplace command, then run another filter command such as grep, and the resulting output will be the output
of grep on command's output.
If no command is specified, edinplace just rewinds its standard input to file offset 0. In this case, it is an error to supply the --file
option. Of course, rewinding only works when standard input is a real file (as opposed to a pipe or device).
There are two options:
--error=code (-x code)
Ordinarily, edinplace attempts to exit with the same status as command. However, if edinplace encounters some fatal error (such as
being unable to execute command), it will exit with status code. The default value is 1. The range of valid exit codes is 1-255,
inclusive.
--file=file (-f file)
Specifies that file should be edited. Otherwise, edinplace will edit its standard input (which must be opened for both reading and
writing).
--skipfrom
Skip the first line of the file if it starts "From ". If edinplace is run without a command, positions the file offset at the start of
the second line of the file. If edinplace is run with a command, then the first line of the file is neither fed to the command, nor
overwritten. This option is useful for running edinplace over mail files, which sometimes start with a "From " line specifying the
envelope sender of the message. Since "From " is not part of the message header, just a Unix convention, some programs are confused by
the presence of that line. Note that if you specify a command, then edinplace resets the file offset to 0 upon exiting, even if the
--skipfrom option was present.
EXAMPLES
The following command prepends the string "ORIGINAL: " to the beginning of each line in text file message:
edinplace -f message sed -e 's/^/ORIGINAL: /'
The following command runs the spamassassin mail filter program on a mail message stored in file message, replacing the contents of message
with spamassassin's annotated output, and exiting with code 100 if spamassassin thinks the message is spam. If edinplace encounters any
fatal errors, it will exit with code 111.
edinplace -x 111 -f message spamassassin -e 100
(spamassassin reads a mail message on standard input and outputs an annotated copy of the message including information about whether or
not the message is likely to be spam and why. The -e option to spamassassin specifies what exit status spamassassin should use if the
message appears to be spam; edinplace will use the same exit code as the program it has run.)
To run spamassassin on incoming mail before accepting the mail from the remote client, place the following line in an appropriate Mail
Avenger rcpt file as the last command executed:
bodytest edinplace -x 111 spamassassin -e 100
SEE ALSO
avenger(1)
The Mail Avenger home page: <http://www.mailavenger.org/>.
BUGS
edinplace does not make a copy of the file being edited, but rather overwrites the file as it is being processed. At any point where
command has produced more output than it has consumed input from the file, edinplace buffers the difference in memory. Thus, a command
that outputs large amounts of data before reading the input file can run edinplace out of memory. (A program that outputs data as it reads
even a very large file should be fine, however.)
If command crashes or malfunctions for any reason, you will likely lose the input file, since edinplace will view this as a program that
simply outputs the empty file.
AUTHOR
David Mazieres
Mail Avenger 0.8.3 2012-04-05 edinplace(1)