grep for x for m times ',\{11\}'


 
Thread Tools Search this Thread
Operating Systems HP-UX grep for x for m times ',\{11\}'
# 8  
Old 07-26-2010
try this:
Code:
 gawk '{split($0,a,","); if ((length(a) - 1) != 11) ; else $0=gensub(/,/,"",7); print}' myfile

EDIT:

Aw I just noticed this was in HP-UX sorry.. No gawk...

Last edited by Ikon; 07-26-2010 at 06:10 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Newbie looking for how to Grep times more than 10 seconds apart

I am new to grep and Linux and am looking to see if grep can parse out a list of lines that have a difference of more than 10 seconds between the times on each line. Example 2016-09-17 19:30:57 INFO: id: 4562079216, time: 2016-09-17 19:30:41, 2016-09-17 12:02:26 INFO: id:... (26 Replies)
Discussion started by: Markham
26 Replies

2. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

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

3. Shell Programming and Scripting

To get difference between 2 times.

Can anyone help me to write a script to get diffrence between 2 times. (platform- solaris) i.e., Diffence shoud be displayed in tems of hours. (Approximately) for eg: file1 = 05-Apr-2012 13:42:32 file2 = 04-Apr-2012 12:42:41 O/P is like : diff = 25 Hrs (2 Replies)
Discussion started by: thomasraj87
2 Replies

4. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

5. Shell Programming and Scripting

Getting logs between two times

Hi, I need to read log file for the period between two time frame.eg all those logs between 3AM to 4M. Any command to use for the shell scripting? Ahamed (5 Replies)
Discussion started by: ahamed
5 Replies

6. UNIX for Dummies Questions & Answers

comparing two times

Hi Good Morning all, I have two dates and times in the beloe format. 1. 07/18/2009 03:45:49 2. 07/18/2009 03:46:41 i will grep these values from a file. Now my problem is i need to find out whether the second valus is bigger thatn the 1 value. How to compare the times. Please help me in... (4 Replies)
Discussion started by: intiraju
4 Replies

7. AIX

how would you know your server was rebooted 3 times or 5 times

Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies

8. AIX

grep to give how many times each lines were found

Lets say I have a file containing string patterns to be looked for inside a file. I would normaly do : grep -if MyFilePattern FiletoSearchInto if I use the -c it gives how many total lines it found out of my whole pattern file, but what if i want grep to report how many times it found each... (4 Replies)
Discussion started by: Browser_ice
4 Replies

9. UNIX for Advanced & Expert Users

Boot times

Hey all, What we have at work is a Themis board (VME rack SPARC system). We have to try to have the boot time as fast as can be. What we have already done is make some filesystems read only so if power is lost then the filesystem check will not run. This is only done to the partitions that... (2 Replies)
Discussion started by: woofie
2 Replies

10. Shell Programming and Scripting

Question about times and so

I've got an logfile like: Start dump db_name1 : Wed Oct 30 15:08:47 MET 2002 Ready dump db_name1 : Wed Oct 30 15:14:46 MET 2002 Start dump db_name2 : Wed Oct 30 15:14:46 MET 2002 Ready dump db_name2 : Wed Oct 30 15:15:36 MET 2002 Start dump db_name3 : Wed Oct 30 15:15:36 MET 2002... (1 Reply)
Discussion started by: TheBlueLady
1 Replies
Login or Register to Ask a Question
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)