01-26-2006
grep pattern filename >> filename
this would append the pattern search into the filename,
is that you want?
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the results of a grep with -n store in a shell variable
ie
VAR=`grep -n -e 'PATTERN' file`
How ever I am missing the line breaks in the variable , How do I store the resualts of grep with many lines in to a variables. I want the varable should be the sawmway as we do the grep
grep... (3 Replies)
Discussion started by: jojan
3 Replies
2. Shell Programming and Scripting
I have a variable A
echo $A
5060
I am exporting the value X,Y,Z and it id fetching right thing and When I run
C=`${X} -l ${Y} ${Z} "trap '' INT;. ~/.profile >/dev/null 2>/dev/null; netstat -na | grep \$A`"
here it is going to same directory and also running netstat -na | grep 5060
... (4 Replies)
Discussion started by: madhusmita
4 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I have a question regarding the awk command. Here is the line I need to grep:
1 F= -.13250138E+03 E0= -.13249556E+03 d E =-.174650E-01 mag= 35.2157
Instead of displaying the number in red I would like to store it as a variable such as X. Is there a way to do this? Thanks for any... (3 Replies)
Discussion started by: modey3
3 Replies
4. Shell Programming and Scripting
Hi,
I have a file contains attribute value pair like..
..name=erick rollno=583.0 pass=recon..
From the above line, i need to grep for only "rollno" and store "rollno=583.0" in a variable.
Pls suggest (6 Replies)
Discussion started by: skraja1982
6 Replies
5. UNIX for Dummies Questions & Answers
Guys, I was wondering what command can be used to parse the "LaxOrdID" field into a separate file? These messages are in thousands and I need to perform a comparision. (6 Replies)
Discussion started by: DallasT
6 Replies
6. Shell Programming and Scripting
Hi, I'm trying to store the output from a grep, I just want the file name.
But couldn't find how to do it.
Basically, I just want to grep <etc> * and I want to store the file name.
There is only one file with the what I'm grepping, so storing in a variable o an array its the same.
If someone... (3 Replies)
Discussion started by: radicaled
3 Replies
7. UNIX Desktop Questions & Answers
Hi ,
I was trying to store the value of a grep command to store in a variable so i can use it somewhere else in my script but i am getting error, i am using bash shell in linux:
var= `grep -n "$DATE" testfile.log | head -n 1 | sed -n 's/^\(*\).*/\1/p`
echo "$var"I get the error: unexpected... (5 Replies)
Discussion started by: learninguser235
5 Replies
8. Shell Programming and Scripting
In a directory i have a file *output* whose contents are changing for every simulation.
zgrep "trace file is" *output* | zgrep g
o/p: trace file is Int_01.1352176388z4f56ec33.0.trace.gz
I want to extract "Int_01.1352176388z4f56ec33.0.trace.gz" from the above result into a variable.
i... (2 Replies)
Discussion started by: twistedpair
2 Replies
9. Shell Programming and Scripting
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies
LEARN ABOUT OPENDARWIN
bzgrep
BZGREP(1) General Commands Manual BZGREP(1)
NAME
bzgrep, bzfgrep, bzegrep - search possibly bzip2 compressed files for a regular expression
SYNOPSIS
bzgrep [ grep_options ] [ -e ] pattern filename...
bzegrep [ egrep_options ] [ -e ] pattern filename...
bzfgrep [ fgrep_options ] [ -e ] pattern filename...
DESCRIPTION
Bzgrep is used to invoke the grep on bzip2-compressed files. All options specified are passed directly to grep. If no file is specified,
then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to
grep.
If bzgrep is invoked as bzegrep or bzfgrep then egrep or fgrep is used instead of grep. If the GREP environment variable is set, bzgrep
uses it as the grep program to be invoked. For example:
for sh: GREP=fgrep bzgrep string files
for csh: (setenv GREP fgrep; bzgrep string files)
AUTHOR
Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
SEE ALSO
grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1)
BZGREP(1)