Searching and printing only required pattern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Searching and printing only required pattern
# 1  
Old 01-29-2014
thanks a lot Akshay....could you please explain me )([[:space:]]+$|$|,)/{gsub(/,/,x) this part of script also i am taking output of the last line that is core:1 as final output by piping this commands output with tail -1...
is this possible via awk.

thanks again for making me understand use of awk..great

also i am trying to apply same logic in finding the logical processor count using the script which u have provided from the output :

PHP Code:
System Hardware
    Model
:              ia64 hp Integrity Virtual Partition
    Main Memory
:        6137 MB
    Processors
:         2
        Intel
(R)  Itanium(R)  Processor 9560 (2.53 GHz32 MB)
        
8 cores16 logical processors per socket
        6.38 GT
/s QPICPU version D0
               Active processor count
:
               
1 socket
               1 core
               2 logical processors 
(2 per socket)
               
LCPU attribute is enabled 
script which i am using is :
Code:
 
print_manifest | awk '/([[:digit:]]+[[:space:]])(logical processors)([[:space:]]+$|$|,)/{gsub(/,/,x);print $2":"$1}'

but its not giving any output..can u let me know hwere i am going wrong...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Echo not printing the variables with delimiters as required

This is the file which contains only neccessary values from the output of curl command i.e TEMP_FILE Proxy Hostname server0123.domain.com Proxy IP address XXX.XXX.XX.XX port 0000 Proxy Version SGOS X.X.X.X Proxy Serial # ... (5 Replies)
Discussion started by: ramprabhum
5 Replies

2. Shell Programming and Scripting

Help required in printing in specific format

Hi All, I 'm matching two files based on the first 2 columns and then populate other fields along with subtraction of few fields. I have managed to get the output. However, is there a easier way in formatting the output as shown below instead of using additional printf for getting fixed width... (4 Replies)
Discussion started by: shash
4 Replies

3. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies

4. Shell Programming and Scripting

Help required in searching of pattern.

i m searching a zone file my domain name is abcd.com my zone file looks like this. abcd.com. IN SOA ns1.abcd.com. root.abcd.com. ( abcd.com. 400 IN A 15.1.1.1 Then i am searching that abcd.com have if below ip... (14 Replies)
Discussion started by: learnbash
14 Replies

5. Shell Programming and Scripting

Searching and printing the only pattern using awk,sed or perl

Hi All, i have an output of command vmstat as below : $ vmstat System configuration: lcpu=4 mem=5376MB ent=1.00 kthr memory page faults cpu ----- ----------- ------------------------ ------------ ----------------------- r b avm fre re pi... (10 Replies)
Discussion started by: omkar.jadhav
10 Replies

6. Shell Programming and Scripting

Searching for a pattern and extracting records related to that pattern

Hi there, Looking forward to your advice for the below: I have a file which contains 2 paragraphs related to a particular pattern. I have to search for those paragraphs from a log file and then print a particular line from those paragraphs. Sample: I have one file with the fixed... (3 Replies)
Discussion started by: danish0909
3 Replies

7. Shell Programming and Scripting

Searching using awk - Help required

Hi... I am working on script to search some records in a file based on certain fields and each record is a ASCII fixed size. I was using awk to search based on certain condition. But the length of the record is too much that awk is giving syntax error near unexpected token `(' Request... (5 Replies)
Discussion started by: ysrikanth
5 Replies

8. UNIX for Dummies Questions & Answers

Help required on Printing of Numbers, which are missing in the range

Hi Experts, Need help on printing of numbers, which are missing in the range. Pls find the details below Input 1000000002 1000000007 1234007940 1234007946 Output 1000000003 1000000004 1000000005 1000000006 1234007941 (2 Replies)
Discussion started by: krao
2 Replies

9. Shell Programming and Scripting

Searching a pattern in file and deleting th ewhole line containing the pattern

Hi All, Please can someone assist in the script I have made that searches a pattern in a file and delete the whole line containing the pattern. #!bin/sh # The pattern that user want to add to the files echo "Enter the pattern of the redirect" read value # check if the user has... (1 Reply)
Discussion started by: Shazin
1 Replies

10. Shell Programming and Scripting

Pattern searching pattern in c files

I have a problem in searching a specific pattern in c files. My requirement: I have to find all the division operator in all cfiles. The problem is, the multi line comments and single line comments will also have forward slash in it. Even after avoiding these comments also, if both... (6 Replies)
Discussion started by: murthybptl
6 Replies
Login or Register to Ask a Question