Sponsored Content
Homework and Emergencies Emergency UNIX and Linux Support Complicated SED search required Post 302371477 by ahmad.diab on Sunday 15th of November 2009 04:43:57 AM
Old 11-15-2009
Quote:
Originally Posted by Scrutinizer
What do you mean a start Smilie. It seems to work really well, also for multiple MIB descriptions. I managed to shorten it a little:
Code:
awk '
  { $1 = $1 }
  /DESCRIPTION/ { p=" "; next }
  p { p=p" "$0; if (/"$/) {gsub(/ *"/,"",p); print p;p=""}}
' infile


This code is printing the first DESCRIPTION paragraph but if there 2 or more this code will print only the first paragraph.


ex:-
paragraph..

Code:
ENTERPRISE compaq
        VARIABLES  { sysName, cpqHoTrapFlags, cpqSsBoxCntlrHwLocation,
                     cpqSsBoxCntlrIndex, cpqSsBoxBusIndex, cpqSsBoxVendor,
                     cpqSsBoxModel, cpqSsBoxSerialNumber, cpqSsBoxFanStatus }
        DESCRIPTION
           "Storage System fan status change.

            The agent has detected a change in the Fan Status of a storage
            system.  The variable cpqSsBoxFanStatus indicates the current
            fan status.

            User Action: If the fan status is degraded or failed, replace
            any failed fans."

              --#TYPE "Fan Status Change (8026)"

DESCRIPTION
000000000000000000000000
3333333333333333333333
211111111111111111

--#TYPE i7i7i7i

output is

Code:
Storage System fan status change.  The agent has detected a change in the Fan Status of a storage system. The variable cpqSsBoxFanStatus indicates the current fan status.  User Action: If the fan status is degraded or failed, replace any failed fans.

so the code need modification...it is a start as scottn said.
BR
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help in sed required.

Hi All, I am facing a small problem in sed. I want to insert a line in the existing file. Existing code: access to attr=userPassword by self write by * auth access to * by self write by users read by anonymous auth Desired code: access to attr=userPassword by self... (14 Replies)
Discussion started by: nua7
14 Replies

2. Shell Programming and Scripting

complicated search within file

Hi, I have following problem. I have a file with time stamps and some data describing what happened between time stamps. Something like this: 10:00 meeting with K meeting with L 11:00 lunch 12:00 work with K 13:00 From this file I have to get a file with... (7 Replies)
Discussion started by: mmike
7 Replies

3. Shell Programming and Scripting

Script Search replace - complicated

I have a text file for which i need a script which does some fancy search and replace. Basically i want to loop through each line, if i find an occurance of certain string format then i want to carry on search on replace another line, once i replaced this line i will contine to search for the... (7 Replies)
Discussion started by: kelseyh
7 Replies

4. Shell Programming and Scripting

Search complicated strings on file

Can someone help me? I been figuring out how I can search and extract a complicated search string from a file. The whole string is delimited by a period. And the file where I'm searching is composed of differnt string such as that. For example, I have this search string: and I have a file... (3 Replies)
Discussion started by: Orbix
3 Replies

5. Shell Programming and Scripting

Parsing complicated CSV file with sed

Yes, there is a great doc out there that discusses parsing csv files with sed, and this topic has been covered before but not enough to answer my question (unix.com forums). I'm trying to parse a CSV file that has optional quotes like the following: "Apple","Apples, are fun",3.60,4.4,"I... (3 Replies)
Discussion started by: analog999
3 Replies

6. Shell Programming and Scripting

sed help required

Hi All, I have one file with below type of data in it, $ cat test.txt ###123 ###xyxytuerwb ###2 ###tyupe Here I would like to replace all the characters with "x" after the 3 "###" with the same number of characters. Can you please help me to achieve this. (7 Replies)
Discussion started by: gr8_usk
7 Replies

7. Shell Programming and Scripting

sed with complicated variable pattern

Hi, Below is the content of the file how it looks: # EMAIL #export BMS_EMAIL_ENABLED=true export BMS_EMAIL_ENABLED=false #export BMS_EMAIL_SERVER=esasmtp01.kohls.com export BMS_EMAIL_SERVER=esasmtp01.kohls.com.SMTP_SERVICE export BMS_EMAIL_FROM_ADDRESS=ec_notify@kohlsectest.com export... (4 Replies)
Discussion started by: pravintse
4 Replies

8. Shell Programming and Scripting

sed help - search/copy from one file and search/paste to another

I am a newbie and would like some help with the following - Trying to search fileA for a string similar to - AS11000022010 30.4 31.7 43.7 53.8 60.5 71.1 75.2 74.7 66.9 56.6 42.7 32.5 53.3 I then want to replace that string with a string from fileB - ... (5 Replies)
Discussion started by: ncwxpanther
5 Replies

9. UNIX for Beginners Questions & Answers

How to search a text in file and retrieve required lines following it with UNIX command?

I have requirement to search for a text in the file and retrieve required lines that is user defined with unix command. Eg: Find the text UNIX in the below file and need to return Test 8 & Test 9 Test 1 Test 2 Test 3 Test 4 UNIX Test 5 Test 6 Test 7 Test 8 Test 9 Result can... (8 Replies)
Discussion started by: Arunkumarsak4
8 Replies

10. UNIX for Beginners Questions & Answers

Assistance required to decode sed search using /1

Hi, I am trying to extract line number (first number), as well as everything from TSVal onwards. 4 1.474005 172.18.124.142 -> 74.125.228.46 TCP 2450940617 74 44021 > https Seq=0 Win=5840 Len=0 MSS=1380 SACK_PERM=1 TSval=2450940617 TSecr=0 WS=64 6 1.488149 172.18.124.142 ->... (1 Reply)
Discussion started by: sand1234
1 Replies
i8kctl(1)							     Utilities								 i8kctl(1)

NAME
I8kctl, i8kfan - Utility to access SMM BIOS on Dell Inspiron laptops SYNTAX
i8kctl [<command> [<args>]] i8kfan [<left> [<right>]] DESCRIPTION
The i8kctl utility provides a command-line interface to the i8k kernel driver for Dell Inspiron laptops. When invoked without arguments the program reports the same information which can be read from the /proc/i8k file: 1. i8k format version 2. bios version 3. machine id 4. cpu temperature 5. left fan status 6. right fan status 7. left fan speed 8. right fan speed 9. ac power status 10. fn buttons status The optional command argument can be used to select only one of the above items. Command can be: version, bios, id, temp, fan, speed, ac and fn. Examples: $ i8kctl 1.0 A17 B5W123K 52 2 1 8040 6420 1 2 $ i8kctl temp 52 $ i8kctl fan 2 1 The fan command can accept two optional parameters which specify the new fan state for left and right fans. The state parameter can be: 0 turn the fan off 1 set low speed 2 set high speed - don't change the state of this fan For example the command: $ i8kctl fan - 2 sets the right fan to high speed and leaves the left unchanged. It should be noted that if the i8kmon(1) daemon is used to control the fans, setting the speed with i8kfan is pointless since the daemon will override the speed with its own value. Invoking i8kctl as i8kfan is the same as invoking the program with the fan option: $ i8kctl fan 1 2 1 2 $ i8kfan 1 2 1 2 FILES
/proc/i8k AUTHORS
Massimo Dal Zotto <dz@debian.org> COPYRIGHT
i8kctl and all the i8kutils programs , scripts and other files are distributed under the GNU General Public License (GPL). On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. SEE ALSO
i8kmon(1), i8kbuttons(1) Massimo Dal Zotto 18 March 2002 i8kctl(1)
All times are GMT -4. The time now is 02:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy