This may be a repetitive or simple question, but I have a long running code, which uses a grep with a big argument, and i was wondering if there was a way to replace all of my greps with awk....here are my two commands using greps.
and
the second seems to work particularly better than the first. Its purpose is to find all occurrences of .20 .20 with six characters in the middle. I do not think that either statement is very efficient, if an awk statement exist which would better replace these statements, and what these awk statements are.
Thank you.
Last edited by Scott; 07-18-2011 at 10:37 AM..
Reason: Code tags, please...
Hi Guys,
I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys.
MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' `
Harby. (4 Replies)
#cat BATCH007.TXT
01,661060052,061000104,081118,0915,07,80,1,2/
99,,,2/
I have this file called BATCH007.TXT. I am trying to change fields 2 and 3 on line 2 to have zeroes. Like this:
01,661060052,061000104,081118,0915,07,80,1,2/
99,0,0,2/
I can use these commands to print identify the... (2 Replies)
Hi there!
I'm new in this and probably is a quite simple task but I still cannot manage to do it:
I have to read some files line by line and then change the input format into another one, but the very first step is to replace the empty variables by error values. I mean, each line looks like:... (2 Replies)
Hi there !
I have text files with some nonsense characters in it, so different text editors put different nonsense symbols, and, worse, the application that should be able to read these files doesn't.
With xxd, the nonsense characters show as "efbfbd", while they should be "c2a7" (the... (2 Replies)
I have a string and want to replace the / with a space.
For example having "SP/FS/RP" I want to get "SP FS RP"
However I am having problems using gsub
set phases = `echo $Aphases | awk '{gsub(///," ")}; {print}'` (5 Replies)
Hello,
I need to insert varying lines (i.e. these lines are an output of another script) between lines starting with certain fields.
An example to make it more clear.
This is the file where I wanna insert lines:
(save it as "input.txt")
ContrInMi_c_mir 2 10066 181014 200750... (12 Replies)
I am trying to replace
javascript:top.showarticle('geo',1985,'with
../../abstracts/geo1985/I am using awk but getting an error
awk -v s="javascript:top.showarticle('geo',1985,'" -v d="../../abstracts/geo1985/" '{gsub(s,d); print} ' geo50n12.html > geo50n12.html.tmp
Fixed it using
... (3 Replies)
how to replace grep with awk commands.
i have a code like:
grep -w $student $markfile|$subjectid
can similar code be written by replacing grep with awk.
Thanks in advance,
regards,
giri (6 Replies)
Hi I'm trying trying to replace '~/Documents/research/racedata' with '..' in all files in a directory. What is the best way I should go about this? Thanks. (4 Replies)
Hi All,
I need to replace a match with are new values when there is a double match.
grep 04422494 MAX.dat | grep 1102300131
I need to replace 1102300131 as 1101600131 in MAX.dat only for the record matching 04422494 . I tried replace as
sed/s/1102300131 /1101600131 /g MAX.dat
... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
LEARN ABOUT MINIX
zgrep
ZGREP(1) General Commands Manual ZGREP(1)NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other 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 the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)ZGREP(1)