01-17-2011
script to grep number
hi all,
i would like to create a script that would grep the number in the following pattern
xx xx xx xx xx xx
note that xx are numbers.
i would grep in information in a .rep file.
can i get an idea how to do it
thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have multiple files where it starts with test1.c, test2.c,test3.c and so on.
I would like to get each file separately to perform abstraction from these files.
I tried something like:-
for t in ./*
filenumber=${t:4} # to cut the "test" in order to get the number
cat... (3 Replies)
Discussion started by: ahjiefreak
3 Replies
2. UNIX for Dummies Questions & Answers
I am given a file with a list of names for the first 20 characters. The 20 characters after is a list of names that somebody is supposed to team up with.
Now i'm trying to write a simple script that will read a name somebody inputs and then looks only in the first 20 characters.
For example.... (2 Replies)
Discussion started by: MaestroRage
2 Replies
3. UNIX for Dummies Questions & Answers
File1.txt
.......
.......
OMC LA
OMC LK
OMC LS
........
........
Above is the content of File1.txt, i want to get the Number of Occurence to order, lets say if OMC LA = 1, OMC LS=3, and OMC LK=2..
omc_ident="OMC LA" or "OMC LK" or "OMC LS"
omc_num=`grep '^OMC' File1.txt| grep... (4 Replies)
Discussion started by: neruppu
4 Replies
4. Shell Programming and Scripting
Hi,
I want to search for a return code of -3. Using grep "-3" *.* is giving a syntax error. Please suggest as to how can we search for this pattern using grep.
Thanks,
Krishna (2 Replies)
Discussion started by: kzmatam
2 Replies
5. UNIX for Dummies Questions & Answers
I have a data file that is arranged like this:
Marketing Ranjit Singh Eagles Dean Johnson FULL
Marketing Ken Whillans Eagles Karen Thompson FULL
Sales Peter RobertsonGolden TigersRich Gardener PART
President Sandeep Jain Wimps Ken Whillans CONT... (7 Replies)
Discussion started by: hitman247m
7 Replies
6. Shell Programming and Scripting
Dear All,
I plan to write a script and in the beginning, I will check if there's any existing previous process running, if YEs, then exit directly, if Not, then continue.
#!/bin/bash
NUM=`ps -ef | grep $0 | grep -v grep | wc -l`
ps -ef | grep $0 | grep -v grep
echo "NUM ==> $NUM"
if... (6 Replies)
Discussion started by: tiger2000
6 Replies
7. UNIX for Dummies Questions & Answers
which one of the following is the correct expression to ignore line with multiple spaces after any string
cat file | grep -v "xyz *$"
or
cat file | grep -v "xyz*$"
do i need "*" to specify the sapce or " *" will do? (2 Replies)
Discussion started by: manishma71
2 Replies
8. Shell Programming and Scripting
ps -ef |grep /usr/sbin/qdaemon
root 5034194 385266 0 Oct 26 - 1:57 /usr/sbin/qdaemon
root 7639132 2523220 0 15:25:58 pts/10 0:00 grep /usr/sbin/qdaemon
ps -ef |grep /usr/sbin/qdaemon |wc
2 18 145
I need to send out e-mail if the count of the lines... (9 Replies)
Discussion started by: Daniel Gate
9 Replies
9. Shell Programming and Scripting
Hi,
I have variable called fname that has the value M201401151630_P008949.csv.txt
I need to grep and store this in a variable called prcid for the number before ".csv" and the letter "P" excluding all zeros in the beginning.
Desired output 8949
Likewise for M201401151630_P108949.csv.txt... (12 Replies)
Discussion started by: mohtashims
12 Replies
10. Shell Programming and Scripting
Hello,
I am newbie to bash scripting. Could someone help me with the following.
I have log file with output as shown below
**************************LOG*************************
11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data:
11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:... (4 Replies)
Discussion started by: meena_2013
4 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)