Sponsored Content
Full Discussion: Parsing Output of a Variable
Top Forums Shell Programming and Scripting Parsing Output of a Variable Post 302637101 by SkySmart on Tuesday 8th of May 2012 10:53:23 AM
Old 05-08-2012
Parsing Output of a Variable

i have a log file that contains something similar to this:

Code:
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen
one two three four five six seven eight
nine ten eleven twelve thirteen fourteen

the file is on a remote host.

I take the last 10 lines of this file and i store it to a variable. Then this variable is passed down stream through an agent from the remote host to the central monitoring server.

VARA=$(echo `tail -10 /var/log/arm.log`)

When the lines have been sent back to the central monitoring server, it comes out looking like this:

Code:
one two three four five six seven eight nine ten eleven twelve thirteen fourteen one two three four five six seven eight nine ten eleven twelve 
thirteen fourteen one two three four five six seven eight nine ten eleven twelve thirteen fourteen one two three four five six seven eight nine ten eleven
 twelve thirteen fourteen one two three four five six seven eight
nine ten eleven twelve thirteen fourteen

My question is, how do i "disentangle" these lines, and have them return to the type of line-by-line output one would get with a tail -10?

by the way, the words/characters at the beginning and end of each line is always never the same for each line.

OS: Linux RedHat/Ubuntu/Solaris
Shell: Bash
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parsing output from ls command

I have to test the directory name which is obtained from for dir in `ls -l|grep $9 ' i need to check whether it is directory ( if yes, I have to check the first 3 character fo the directory how can I do that? Please help me thanks (3 Replies)
Discussion started by: ajaya
3 Replies

2. Shell Programming and Scripting

parsing output

I have a file that contains the output of the ls -iR command, something like this: ./results: 2504641011 result_1410 2500957642 result_525 2504641012 result_1425 2500957643 result_540 ./tests/1: 2500788755 1 2500788743 1000 ./tests/2: 2500788759 3 2500788758 999 ... (6 Replies)
Discussion started by: looza
6 Replies

3. Shell Programming and Scripting

Parsing output

I need to parse the following out put and determine if the USB is a DISK and whether or not it's External. If an HBA line contains "USB" then does the next line contain "DISK" and "External". 0:0,31,0: HBA : (aacraid,1) AAC SCSI 0,0,0: DISK : Adaptec ASR4800SAS Volu0001 ... (6 Replies)
Discussion started by: lochraven
6 Replies

4. Shell Programming and Scripting

parsing a variable

Hi, I want to get an input from user and parse the input. The legal characters allowed in the input are alnum(a-zA-Z0-0), . , - Also the first and las characters must be alnum only. e.g if the input is abc.ghh-sok.com then the script should return correct, and if the input is like... (2 Replies)
Discussion started by: g_rohit7
2 Replies

5. Shell Programming and Scripting

parsing output of system()

Hi, From the above output of df command I need to parse only 43G (available space) and display it. root@localhost:> df -h /vol1/joy Filesystem Size Used Avail Capacity Mounted on /vol1/joy 180G 137G 43G 76% ... (3 Replies)
Discussion started by: cjjoy
3 Replies

6. UNIX for Dummies Questions & Answers

Parsing a variable

Can someone help me? I have been looking in the archives as I am sure this is very simple to do, but I do not know. I have a variable which sometimes contains a file name and sometimes contains a fully qualified file name. I want to be able to separate the directory from the file name into 2... (3 Replies)
Discussion started by: CAGIRL
3 Replies

7. Shell Programming and Scripting

parsing ifconfig output

I'm trying to gather information on the interfaces on a large number of servers. If I run ifconfig I will get: eth0 Link encap:Ethernet HWaddr 00:50:56:A2:27:C1 inet addr:10.145.xxx.xxx Bcast:10.152.45.255 Mask:255.255.254.0 ----- eth1 Link... (2 Replies)
Discussion started by: C0ppert0p
2 Replies

8. Shell Programming and Scripting

Parsing the date output

Hi fellows, I need to define a notification for SSL certificate expiration. My Command output is below: (this is the "Expiration Date") Tue Mar 15 09:30:01 2012 So, at 15th Feb (1 month before the expiration), a notification has to be triggered by a script or sth else. How can i set an... (5 Replies)
Discussion started by: oduth
5 Replies

9. Shell Programming and Scripting

parsing output

Can somebody provide a solution to parse the following; cat /tmp/xxx Name: QUE_REQU (o.mtaseast-o.dmart) (MTPost queue) Number of messages: 66446 (Age 686 min; Size 214 mb) Backlog (messages): 0 (Age 0 min) Name: QUE_REQU... (6 Replies)
Discussion started by: BeefStu
6 Replies

10. Shell Programming and Scripting

Parsing nsupdate's output

Anybody that's ever used nsupdate knows that it's error management is not very good. I have a wrapper script that when it's got all the information it needs launches the nsupdate command. This is my attempt at parsing the output to help support users quickly know if the command succeded or... (7 Replies)
Discussion started by: maverick72
7 Replies
Authen::Passphrase::EggdropBlowfish(3pm)		User Contributed Perl Documentation		  Authen::Passphrase::EggdropBlowfish(3pm)

NAME
Authen::Passphrase::EggdropBlowfish - passphrases using Eggdrop's blowfish.mod SYNOPSIS
use Authen::Passphrase::EggdropBlowfish; $ppr = Authen::Passphrase::EggdropBlowfish->new( hash_base64 => "9tpsG/61YqX/"); $ppr = Authen::Passphrase::EggdropBlowfish->new( passphrase => "passphrase"); $hash = $ppr->hash; $hash_base64 = $ppr->hash_base64; if($ppr->match($passphrase)) { ... DESCRIPTION
An object of this class encapsulates a passphrase hashed using the Blowfish-based algorithm used in Eggdrop's blowfish.mod. This is a subclass of Authen::Passphrase, and this document assumes that the reader is familiar with the documentation for that class. This hash scheme uses no salt, and does not accept a zero-length passphrase. It uses the passphrase as a Blowfish key to encrypt a standard plaintext block. The hash is the ciphertext block. The standard Blowfish key schedule only accepts keys from 8 to 56 bytes long; this algorithm relaxes that requirement and accepts any non-zero length. Up to 72 bytes of passphrase/key are significant; any more are ignored. In Eggdrop the hash is represented as a "+" followed by twelve base 64 digits. The first six digits encode the second half of the hash, and the last six encode the first half. Within each half the bytes are encoded in reverse order. The base 64 digits are ".", "/", "0" to "9", "a" to "z", "A" to "Z" (in that order). Warning: The hash is small by modern standards, and the lack of salt is a weakness in this scheme. For a scheme that makes better use of Blowfish see Authen::Passphrase::BlowfishCrypt. CONSTRUCTOR
Authen::Passphrase::EggdropBlowfish->new(ATTR => VALUE, ...) Generates a new passphrase recogniser object using the Eggdrop blowfish.mod algorithm. The following attributes may be given: hash The hash, as a string of eight bytes. hash_base64 The hash, as a string of twelve base 64 digits. passphrase A passphrase that will be accepted. Either the hash or the passphrase must be given. METHODS
$ppr->hash Returns the hash value, as a string of eight bytes. $ppr->hash_base64 Returns the hash value, as a string of twelve base 64 digits. $ppr->match(PASSPHRASE) This method is part of the standard Authen::Passphrase interface. SEE ALSO
Authen::Passphrase, Crypt::Eksblowfish::Uklblowfish AUTHOR
Andrew Main (Zefram) <zefram@fysh.org> COPYRIGHT
Copyright (C) 2006, 2007, 2009, 2010, 2012 Andrew Main (Zefram) <zefram@fysh.org> LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-02-07 Authen::Passphrase::EggdropBlowfish(3pm)
All times are GMT -4. The time now is 10:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy