Get some data from a list, using grep or sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Get some data from a list, using grep or sed
# 1  
Old 02-11-2015
Get some data from a list, using grep or sed

Hi, my dear friends,

I have to use very frequently the command of qsum to check the free node for job submitting. However, qsum always shows all the nodes regardless of their status.

Code:
 occupied
        p1 100000mb  48:00:00   1
       p72  51200mb     --      1
       p73  51200mb     --      1   1
       p74  73800mb  48:00:00   1
       p75  73800mb  96:00:00   1
       p76  73800mb  96:00:00   1   1
       p77  73800mb  48:00:00   1
       p78  73800mb  48:00:00   1
       p79  73800mb  96:00:00   1
       p80  73800mb     --      1
       p81  73810mb     --      1
       p89  51200mb     --      1   1
       p90  51200mb     --      1
       p91  73800mb  48:00:00   1
       p92  73800mb  48:00:00   1
       p93  73800mb  48:00:00   1
       p94  73800mb  96:00:00   1
       p95  73800mb  48:00:00   1
       p96  73800mb  48:00:00   1
       p97  73800mb  96:00:00   1
       p98  73800mb  48:00:00   1
      p104  73800mb  48:00:00   1   1

  free
      p105  73800mb  48:00:00
      p106 150000mb  48:00:00
      p107 150000mb  48:00:00

g-queues : for jobs that don't do much IO

  occupied
        g3  51200mb  48:00:00   1   1
        g4  51200mb  48:00:00   1
        g5  51200mb  48:00:00   1
        g6  51200mb  48:00:00   1   1
        g7  51200mb  48:00:00   1
        g8  51200mb  48:00:00   1
       g10  51200mb  48:00:00   1   1
       g11  51200mb  48:00:00   1   1
       g41  20000mb  96:00:00   1   4
       g42  20000mb  96:00:00   1
       g43  20000mb  96:00:00   1   4
       g44  20000mb  96:00:00   1   4
       g45  20000mb  48:00:00   1
       g46  20000mb  48:00:00   1   1
       g47  20000mb  48:00:00   1   7
       g48  20000mb  48:00:00   1
       g58  40960mb  48:00:00   1   7
       g60  40960mb  48:00:00   1   1
       g61  40960mb  48:00:00   1
       g62  40960mb  96:00:00   1
       g64  40960mb  48:00:00   1   1
       g66  40960mb  48:00:00   1
       g67  40960mb  48:00:00   1
       g68  40960mb  96:00:00   1   3

Is there a way to get only the free nodes listed from the command qsum?
For instance, by using qsum | grep ??? or qsum | awk ??? to get the free nodes information.

I thank you very much for your kind help!
It will save me a lot of attention to focus on the job.

zhen

Last edited by joeyg; 02-11-2015 at 03:08 PM.. Reason: Robin added ICODE tags; fixed title
# 2  
Old 02-11-2015
Pipe it through
Code:
qsum | sed -n '/free/,/^$/p'
  free
      p105  73800mb  48:00:00
      p106 150000mb  48:00:00
      p107 150000mb  48:00:00

assuming above is the output of qsum...
This User Gave Thanks to RudiC For This Post:
# 3  
Old 02-11-2015
Hi RudiC, that is exactly what I'm expected the print on the screen. Million thanks!
# 4  
Old 02-12-2015
Code:
qsum | awk -v RS='' ' /free/ '

# 5  
Old 02-12-2015
Hi, anbu! This also did the trick! Great! thanks a lot!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep/sed selected data from a command or file?

Below is the output of a DB2 command. Now I have 2 requirements... Database Partition 0 -- Database TESTDB1 -- Active Standby -- Up 213 days 02:33:07 -- Date 02/22/2016 17:04:50 HADR Information: Role State SyncMode HeartBeatsMissed LogGapRunAvg (bytes) Standby ... (2 Replies)
Discussion started by: rlokesh27
2 Replies

2. Shell Programming and Scripting

Grep exif data

I would like to search for regex in the exif data of a large collection of files (mostly jpg, some nef). For instance "grep_exif Tokyo *.jpg" should return the file names of all files which have "Tokyo" in their exif data. Exiftool could be used to extract the data. I don't really need to grep... (6 Replies)
Discussion started by: bamse
6 Replies

3. Shell Programming and Scripting

Router ping log extract data from it Awk/Sed/grep

Hi, I am new to this world.. Using expect i loging to router and checking ping response to my links. I need to genarate report using this output and that report contains only three file link name, packet loss, latency. my output of script is like below: -bash-3.00$ monmw/mwbkp... (2 Replies)
Discussion started by: jkmistry
2 Replies

4. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

5. UNIX for Dummies Questions & Answers

Advanced grep'in... grep for data next to static element.

I have a directory I need to grep which consists of numbered sub directories. The sub directory names change daily. A file resides in this main directory that shows which sub directories are FULL backups or INCREMENTAL backups. My goal is to grep the directory for the word "full" and then... (2 Replies)
Discussion started by: SysAdm2
2 Replies

6. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

7. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

8. Shell Programming and Scripting

How can i grep for an hour before data

Hi, My log file is something like this. (08/04/2009 00:27:42.179)(:) aaaaaaaaaaaa (08/04/2009 00:27:42.181)(:) bbbbbbbbbbbbbbbb (08/04/2009 01:00:42.713)(:) cd cdc d ddddsksjdkssksksj (08/04/2009 01:02:42.716)(:) raarrarararararara (08/04/2009 01:07:43.036)(:ERROR) Port... (8 Replies)
Discussion started by: rdhanek
8 Replies

9. Shell Programming and Scripting

i want to grep some data from other file

helo all i have 2 files. and i want to grep the contents of first file from the 2nd file. but these files are too large contaning lacks of lines . i'm using for loop but it takes so moch times . is there any other sol. i'm using this code " for var in `cat succ_migrated` do grep $var... (4 Replies)
Discussion started by: dodasajan
4 Replies

10. Shell Programming and Scripting

Big data file - sed/grep/awk?

Morning guys. Another day another question. :rolleyes: I am knocking up a script to pull some data from a file. The problem is the file is very big (up to 1 gig in size), so this solution: for results in `grep "^\ ... works, but takes ages (we're talking minutes) to run. The data is held... (8 Replies)
Discussion started by: dlam
8 Replies
Login or Register to Ask a Question