Sponsored Content
Top Forums Shell Programming and Scripting Grep only specific lines ordered by column/date Post 302558767 by dilibau on Sunday 25th of September 2011 08:05:33 AM
Old 09-25-2011
I think I got what I wanted by doing just a little bit more search Smilie

bpdbjobs | sort -rk 4,7 | awk '{ if ($4 == "196") print $0 }' | sort -rk 8

That gives me something like this:

Code:
946571   Backup   Done    196                          thumb           Differential-Inc                         thumb                               09/24/11 18:35:00  09/25/11 00:00:08  005:25:08              1
946570   Backup   Done    196                          thumb           Differential-Inc                         thumb                               09/24/11 18:35:00  09/25/11 00:00:08  005:25:08              1
946569   Backup   Done    196                          thumb           Differential-Inc                         thumb                               09/24/11 18:35:00  09/25/11 00:00:08  005:25:08              1
946278   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946277   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946276   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946275   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946274   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946273   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946272   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946271   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
946270   Backup   Done    196                     dollar_new                       Full                        Dollar                               09/24/11 04:01:27  09/24/11 06:00:03  001:58:36              1
945954   Backup   Done    196                 atm_monitoring                       Full atm_monitoring.alkhaliji.bank                               09/23/11 21:25:00  09/24/11 06:00:03  008:35:03              1
945953   Backup   Done    196                 atm_monitoring                       Full atm_monitoring.alkhaliji.bank                               09/23/11 21:25:00  09/24/11 06:00:03  008:35:03              1
945952   Backup   Done    196                 atm_monitoring                       Full atm_monitoring.alkhaliji.bank                               09/23/11 21:25:00  09/24/11 06:00:03  008:35:03

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed replace values of column with ordered numbering

Hello, I am trying to write a shell script that will create a gnuplot file. My main problem is that I have a data file with two columns: 1.05929120E+09 5.0000701214792 1.05930096E+09 5.00006386985764 1.05930584E+09 5.00019465404908 1.05931072E+09 5.00031960589719 ... (2 Replies)
Discussion started by: pau
2 Replies

2. Shell Programming and Scripting

script for get lines with specific date

I'm a newbie in AIX, i want to make a script for grep any lines with date bellow 20 PRINT0089-88615 data1 3072 Mon Dec 19 17:53:49 WITA 2011 PRINT0089-88616 data1 4096 Mon Dec 19 17:53:49 WITA 2011 PRINT0089-88618 data1 5120 Mon Dec 19... (7 Replies)
Discussion started by: michlix
7 Replies

3. Shell Programming and Scripting

Grep all lines for a specific date in log-files

I need to grep all lines for "yesterday" in /var/log/messages. Dates are in the format "YYYY-MM-DD". (5 Replies)
Discussion started by: Padmanabhan
5 Replies

4. Shell Programming and Scripting

Extract lines with unique value using a specific column

Hi there, I need a help with extracting data from tab delimited file which look like this #CHROM POS ID REF ALT Human Cow Dog Mouse Lizard chr2 3033 . G C 0/0 0/0 0/0 1/1 0/0 chr3 35040 . G T 0/0 0/0 ./. 1/1 0/1 chr4 60584 . T G 1/1 1/1 0/1 1/1 0/0 chr10 7147815 . G A 0/0 1/1 0/0 0/0... (9 Replies)
Discussion started by: houkto
9 Replies

5. Shell Programming and Scripting

How to awk or grep the last column in file when date on column contains spaces?

Hi have a large spreadsheet which has 4 columns APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96034 Storage Mgmt Team APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies

6. UNIX for Dummies Questions & Answers

Grep specific lines

Hello I have a file with nearly 90000 lines in x,y,z format but have some lines that I do not need to show. Is there anyway to delete those 3 lines after every 288 lines. Eg I keep the first 288 lines delete (289, 290 291); keep the next 288 lines after those and so on... Thanks (6 Replies)
Discussion started by: Madiouma Ndiaye
6 Replies

7. Shell Programming and Scripting

Grep on a value in a specific column

I need to grep all records from a file that has 1072 in 3rd column. 1072 can be prefixed by "SBC.", "CLS." or "DPT.". My search is just based on string 1072 in 3rd column. Delimiter in the file is tab. For example: Input FIle: "InvType" "Organization" "SBC.10720101" "CP.BUP.NY" "InvType"... (4 Replies)
Discussion started by: yale_work
4 Replies

8. UNIX for Dummies Questions & Answers

Highlighting specific column in cat/grep

I have a large * delimited text file and need to highlight specific columns on specific lines. The file looks similar to this: ABC*01*00*01*00000 000000 *00000 000000 *35*0*0*0*0*20000*0*0*1*0000*00*4*0*3*0*0*1*0* *35*0000*001*4*1OT2*0148*0*0*0*0*0*0*6A7801B0**TEST1... (1 Reply)
Discussion started by: say170
1 Replies

9. Shell Programming and Scripting

Can grep a specific column?

Hello All I have an input file with data below. I would like to grep and display the data where 3rd column contains string or at least one character. Kindly please help me with this! Input: tjfa3|zznpou|224fdd.34.ff3.35 |Tiv|Otj|1 fgduul7|zznikj| ... (7 Replies)
Discussion started by: DoveLu
7 Replies

10. UNIX for Beginners Questions & Answers

Help with Grep Specific Date From One File Into A New One

Hello All, First post, don't know much about Linux/Unix, but I need some help. Normally, I do grep 'what I'm searching for' FILE > file.txt so I can pull data from one file, and put it into a new one. The issue I am having is with specific dates, since the date field is 4, and it appears... (3 Replies)
Discussion started by: DennisG34
3 Replies
SVK::Log::Filter::Grep(3)				User Contributed Perl Documentation				 SVK::Log::Filter::Grep(3)

SYNOPSIS
SVK::Log::Filter::Grep - search log messages for a given pattern DESCRIPTION
The Grep filter requires a single Perl pattern (regular expression) as its argument. The pattern is then applied to the svn:log property of each revision it receives. If the pattern matches, the revision is allowed to continue down the pipeline. If the pattern fails to match, the pipeline immediately skips to the next revision. The pattern is applied with the /i modifier (case insensitivity). If you want case-sensitivity or other modifications to the behavior of your pattern, you must use the "(?imsx-imsx)" extended pattern (see "perldoc perlre" for details). For example, to search for log messages that match exactly the characters "foo" you might use svk log --filter "grep (?-i)foo" However, to search for "foo" without regards for case, one might try svk log --filter "grep foo" The result of any capturing parentheses inside the pattern are not available. If demand dictates, the Grep filter could be modified to place the captured value somewhere in the stash for other filters to access. If the pattern contains a pipe character ('|'), it must be escaped by preceding it with a '' character. Otherwise, the portion of the pattern after the pipe character is interpreted as the name of a log filter. STASH
/PROPERTY MODIFICATIONS Grep leaves all properties and the stash intact. perl v5.10.0 2008-08-04 SVK::Log::Filter::Grep(3)
All times are GMT -4. The time now is 03:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy