Sponsored Content
Top Forums Shell Programming and Scripting Script to get required output from textfile Post 302768884 by surender reddy on Sunday 10th of February 2013 09:04:00 AM
Old 02-10-2013
Hi

below are few lines from input file

HTML Code:
IP IS 10.238.48.225
spawn telnet 10.238.48.225
Trying 10.238.48.225...
Connected to 10.238.48.225.
Escape character is '^]'.

bgl-ras-bng-jnr-04

[bsnl.in]bgl-ras-bng-jnr-04#show sub sum all 
--------------------------------------------------------------------------------
Total=10066

Type            Authenticating          Active          Disconnecting
PPP                          0               0                      0
PPPoE                        2           10064                      1
DOT1Q                        0               0                      0
CLIPs                        0               0                      0
ATM-B1483                    0               0                      0
ATM-R1483                    0               0                      0
Mobile-IP                    0               0                      0
[bsnl.in]bgl-ras-bng-jnr-04#exit
Connection to 10.238.48.225 closed by foreign host.
IP IS 10.238.49.1
spawn telnet 10.238.49.1
Trying 10.238.49.1...
Connected to 10.238.49.1.
Escape character is '^]'.

chn-ras-bng-hdw-01

[local]chn-ras-bng-hdw-01#cont bsnl.in
[bsnl.in]chn-ras-bng-hdw-01#show sub sum all 
--------------------------------------------------------------------------------
Total=7567

Type            Authenticating          Active          Disconnecting
PPP                          0              19                      0
PPPoE                        4            7544                      5
DOT1Q                        0               0                      0
CLIPs                        0               0                      0
ATM-B1483                    0               0                      0
ATM-R1483                    0               0                      0
Mobile-IP                    0               0                      0
[bsnl.in]chn-ras-bng-hdw-01#exit
Connection to 10.238.49.1 closed by foreign host.
IP IS 10.238.49.33
spawn telnet 10.238.49.33
Trying 10.238.49.33...
Connected to 10.238.49.33.
Escape character is '^]'.
the modifed code is giving syntax error

code

HTML Code:
root@blr-svr-oclan-01 # awk 'BEGIN {print "IP HOST_NAME SUB "}
/IP IS/ {IP=$3}
/local/ {HOST=$1;sub(/\[[^\]]*\]/,"",HOST);sub(/#.*/,"",HOST)}
/PPPoE/ {SUB=$3 ;print IP, HOST, SUB}
'sub_report_20130210_10:00:00
output
HTML Code:
awk: syntax error near line 3
awk: illegal statement near line 3
awk: syntax error near line 3
awk: illegal statement near line 3
awk: illegal statement near line 4
awk: syntax error near line 5
awk: bailing out near line 5
root@blr-svr-oclan-01 # 
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

formatting textfile inside ksh script using awk not working

I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command. I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the the awk command statement shown here. Please help. ... (6 Replies)
Discussion started by: tekline
6 Replies

2. Shell Programming and Scripting

help me how to use nawk for required output

Hi all i have 2 input files 1st file is N1 | N2|N3|N4|N5|N6|N7|N8|N9 4041491000|245160|1|0|0|1|0|0|0 4041401505|152178|1|1|1|1|0|0|0 4041450004|014052|1|1|1|1|0|0|0 4041450005|580916|1|1|1|1|0|0|0 4041491000|230990|1|0|1|1|0|0|0 4041460001|338317|1|1|1|1|0|0|0 2nd file N1 |... (8 Replies)
Discussion started by: dodasajan
8 Replies

3. Shell Programming and Scripting

how to get the correct alignment in a textfile to a mail using shell script?

Hi All, Can any one solve this prob. Im sending a textfile content as a mail body while sending a mail using shell script. But, that textfile content is a unic command output. So, in mail, im not getting the correct alignment as in textfile. What may be the reason behind this. Can... (1 Reply)
Discussion started by: suman_dba1
1 Replies

4. Shell Programming and Scripting

output required

Hi I have the following output Message man amm (9196) is calling Hello & Alert man amtrr (9197) is stopped Find amfi (19198) is cancelled Engine Item aea (19203) is notified Engine Item2 aea2 ... (8 Replies)
Discussion started by: PrasannaKS
8 Replies

5. Shell Programming and Scripting

perl required output

Hi, I have a string in log file from that i need to pick the username. the string is like this-- pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid... (5 Replies)
Discussion started by: namishtiwari
5 Replies

6. Shell Programming and Scripting

Regarding overwriting the textfile with output what we get!

Hi freinds, My problem is I have a script which is used for our office work... in that with my userid i can append the LOGFILE with the output which i get while running the script.. for this i use the below command output >> $LOGFILE but with the same script my colleague is... (6 Replies)
Discussion started by: smarty86
6 Replies

7. UNIX for Dummies Questions & Answers

Script to add text before the first word on a line in a textfile.

How can i make a script to add text before the first word on a line in a textfile : Example: Old line: is my place New line: this is my place Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (3 Replies)
Discussion started by: mjanssen
3 Replies

8. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

9. Ubuntu

Top output to textfile not working in cronjob

Hello, If i run the following script from the cmdline it works just fine however if i run it via root cronjob it doesn't write to the file at all. It is chmod 777 now so shouldnt be any right issues. Shellscript looks like this: /usr/bin/top -b -n 1 -u nagios >> /var/log/test.log Cronjob... (7 Replies)
Discussion started by: heady89
7 Replies

10. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies
RAS-MC-CTL(8)						RAS memory controller admin utility					     RAS-MC-CTL(8)

NAME
ras-mc-ctl - RAS memory controller admin utility SYNOPSIS
ras-mc-ctl [OPTION]... DESCRIPTION
The ras-mc-ctl program is a perl(1) script which performs some useful RAS administration tasks on EDAC (Error Detection and Correction) drivers. OPTIONS
--help Display a brief usage message. --mainboard Print mainboard vendor and model for this hardware, if available. The method used by ras-mc-ctl to obtain the mainboard vendor and model information for the current system is described below in the MAINBOARD CONFIGURATION section. --status Print the status of EDAC drivers (loaded or unloaded). --quiet Be less verbose when executing an operation. --register-labels Register motherboard DIMM labels into EDAC driver sysfs files. This option uses the detected mainboard manufacturer and model num- ber in combination with a "labels database" found in any of the files under /etc/ras/dimm_labels.d/* or in the labels.db file at /etc/ras/dimm_labels.db. An entry for the current hardware must exist in the labels database for this option to do anything. --print-labels Display the configured labels for the current hardware, as well as the current labels registered with EDAC. --guess-labels Print DMI labels, when bank locator is available at the DMI table. It helps to fill the labels database at /etc/ras/dimm_labels.d/. --labeldb=DB Specify an alternate location for the labels database. --delay=time Specify a delay of ime seconds before registering dimm labels. Only meaninful if used together with --register-labels. --layout Prints the memory layout as detected by the EDAC driver. Useful to check if the EDAC driver is properly detecting the memory con- troller architecture. MAINBOARD CONFIGURATION
The ras-mc-ctl script uses the following method to determine the current system's mainboard vendor and model information: 1. If the config file /etc/edac/mainboard exists, then it is parsed by ras-mc-ctl. The mainboard config file has the following simple syn- tax: vendor = <mainboard vendor string> model = <mainboard model string> script = <script to gather mainboard information> Where anything after a '#' character on a line is considered a comment. If the keyword script is specified, then that script or exe- cutable is run by ras-mc-ctl to gather the mainboard vendor and model information. The script should write the resulting information on stdout in the same format as the mainboard config file. 2. If no mainboard config file exists, then ras-mc-ctl will attempt to read DMI information from the sysfs files /sys/class/dmi/id/board_vendor /sys/class/dmi/id/board_name 3. If the sysfs files above do not exist, then ras-mc-ctl will fall back to parsing output of the dmidecode(8) utility. Use of this util- ity will most often require that ras-mc-ctl be run as root. SEE ALSO
fBrasdaemon(1) RAS-MC-CTL(8)
All times are GMT -4. The time now is 03:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy