I have a file which keeps count based on completion of a certain activity. I am using the following grep command to return a '1' in case the count is zero
Now the issue happens when the count is '10', '20' etc .. in these cases as well it returns a '1' because it sees a zero at the end of the count ..
Kindly, help me, how can I get a '1' using grep only when there is a zero count in abc_count.
Thanks
Please, try the following and see if your grep has the support for it:
If you only see the expected results, then you can add the -c flag to return the count. The -i is not necessary because 0 will not make a difference for case insensitivity
How to print all lines that has exactly 3 occurences of digit 4 using grep?
I am able to find the pattern if it is for atleast 3 occurences but with exactly 3 occurences? Can anybody help me on this. (3 Replies)
I have a script like this--
#!/bin/ksh
echo "To pad a 0 before digits from 1-9"
for i in $*
do
echo $i | sed 's//'0'/g'
done
I run this script as
ksh name 1 2 23 34
The output should be
01 02 23 34
Help me in modifying this script.
Thanks
Namish (2 Replies)
hi all,
how do i format the date command so it displays day and month in single digits i.e 8 instead of 08 ??
am using the command (in a ksh) : date +%D
output i get is 10/08/08
thanks in advance. (5 Replies)
hi all,
how do i get the month in single digit in ksh script ?? my command for date is :
/usr/bin/date +%Om/%Oe/%y | sed 's/ //g'
which returns "01/16/09" but i need the output to be "1/16/09" i.e the month without leading zero.
thanks in advance. (2 Replies)
I have a var storing date
var=`date`
Now the date is returned as
Mon Feb 2 00:25:48 PST 2009
Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var"
My intention in above case is... (3 Replies)
how can i list all files in my home directory that have a 4 digit id number, the line number where the id is located and the id itself not printing the entire line? (5 Replies)
Hi ,
how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example
pattern file pattern.txt
pattern num
bala 2
raja 3
muthu 4
File Name: chennai.dat
muthu is good boy
raja is bad boy
selvam in super... (6 Replies)
Hello All,
I'm a newbie/rookie in Shell scipting. I've done oracle export of a table using Export utility. When I do export, it generates 2 files.
1> .dmp file
2> .dmp.log file.
In .dmp.log file I have to search for a sentence which goes like '0 records have been inserted' and then... (2 Replies)
Hi,
I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line,
if it starts with 2 or more digits then i have to keep the line
Here is a sample of my file:
377 CARRER DE LA... (5 Replies)
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)