Sponsored Content
Top Forums Shell Programming and Scripting Get distinct value in bash between two string Post 302967267 by cterra on Monday 22nd of February 2016 04:35:03 AM
Old 02-22-2016
Get distinct value in bash between two string

Sorry for my english i am french

So i am receiving from a script this prompt :
Code:
tabular;critical;mirroring;DG INTlocaldg VOLUME appears
tabular;critical;mirroring;DG INTlocaldg VOLUME bh3vm
tabular;critical;mirroring;DG INTlocaldg VOLUME dev
tabular;critical;mirroring;DG INTlocaldg VOLUME earsdev
tabular;critical;mirroring;DG INTlocaldg VOLUME earslivraison
tabular;critical;mirroring;DG INTlocaldg VOLUME earsrct
tabular;critical;mirroring;DG INTlocaldg VOLUME ed
tabular;critical;mirroring;DG INTlocaldg VOLUME eng
tabular;critical;mirroring;DG INTlocaldg VOLUME home
tabular;critical;mirroring;DG INTlocaldg VOLUME home_Ctibco6
tabular;critical;mirroring;DG INTlocaldg VOLUME home_adapter
tabular;critical;mirroring;DG INTlocaldg VOLUME icf
tabular;critical;mirroring;DG INTlocaldg VOLUME investigation
tabular;critical;mirroring;DG INTlocaldg VOLUME isa_dev
tabular;critical;mirroring;DG INTlocaldg VOLUME isa_rct
tabular;critical;mirroring;DG INTlocaldg VOLUME isa_share
tabular;critical;mirroring;DG INTlocaldg VOLUME livraison
tabular;critical;mirroring;DG INTlocaldg VOLUME mq
tabular;critical;mirroring;DG INTlocaldg VOLUME mqlog
tabular;critical;mirroring;DG INTlocaldg VOLUME mqprod
tabular;critical;mirroring;DG INTlocaldg VOLUME mqvar
tabular;critical;mirroring;DG INTlocaldg VOLUME netbackup
tabular;critical;mirroring;DG INTlocaldg VOLUME od-home
tabular;critical;mirroring;DG INTlocaldg VOLUME oracle
tabular;critical;mirroring;DG INTlocaldg VOLUME oradb
tabular;critical;mirroring;DG INTlocaldg VOLUME ov
tabular;critical;mirroring;DG INTlocaldg VOLUME rct
tabular;critical;mirroring;DG INTlocaldg VOLUME rc3
tabular;critical;mirroring;DG INTlocaldg VOLUME sar
tabular;critical;mirroring;DG INTlocaldg VOLUME soa
tabular;critical;mirroring;DG INTlocaldg VOLUME tibbh3
tabular;critical;tibco;DG INTlocaldg VOLUME tibco
tabular;critical;tibco;DG INTlocaldg VOLUME tibco_dev6
tabular;critical;tibco;DG INTlocaldg VOLUME tibco_rc2
tabular;critical;tibco;DG INTlocaldg VOLUME tibcobh3
tabular;critical;mirroring;DG INTlocaldg VOLUME tws00
tabular;critical;mirroring;DG INTlocaldg VOLUME unix
tabular;critical;was;DG INTlocaldg VOLUME was6
tabular;critical;was;DG INTlocaldg VOLUME was6dev
tabular;critical;was;DG INTlocaldg VOLUME was6devcells
tabular;critical;was;DG INTlocaldg VOLUME was6devlogs
tabular;critical;was;DG INTlocaldg VOLUME was6devproduct
tabular;critical;was;DG INTlocaldg VOLUME was6distrib
tabular;critical;was;DG INTlocaldg VOLUME was6rct
tabular;critical;was;DG INTlocaldg VOLUME was6rctcells
tabular;critical;was;DG INTlocaldg VOLUME was6rctlogs
tabular;critical;was;DG INTlocaldg VOLUME was6rctproduct
tabular;critical;was;DG INTlocaldg VOLUME was6share

I need to get the list of my error type
Basicly i need to get distinct value between 'critical'; and the third ';'
was
tibco
mirroring

in this exemple, but i can have lot of more.

Can i do this with one command, or should i put all in one table and compare every value ?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash string replace

Bash shell. I'm trying to filter a string taken from user input. I can replace one word at a time. This method supports regex, so is it possible to replace various words at a time? STRING="Hello World! word1 word2"; FILTERED=${STRING/word1|word2/}; # Not working: replace 2 or more words ??? ... (10 Replies)
Discussion started by: limmer
10 Replies

2. Shell Programming and Scripting

String comparison using bash

I have a program to create a directory if not present. Here is the program. FYI: Directory name format: YYYY_MM_DD #!/bin/bash date=`date +%Y_%m_%d` presence=$(ls -lrt /TS_File/ | grep "$date" | awk '{print $9}') if then mkdir /TS_File/$date else echo "Unable to Create... (5 Replies)
Discussion started by: nthiruvenkatam
5 Replies

3. Shell Programming and Scripting

Get the distinct string from file.

my question is , i want to get the distinct email address from the file which contains: <Email address>|<file name> /tmp/test.log petercs@yahoo.com|sf1.pdf sandycs@yahoo.com|sf2.pdf davidcs@yahoo.com|sf3.pdf davidcs@yahoo.com|sf4.pdf i want to get the result like: petercs@yahoo.com... (5 Replies)
Discussion started by: bearonweb
5 Replies

4. Shell Programming and Scripting

bash string manipulation

Hello guys, here is my problem: I got a shell script which is called by an external piece of software, the external software is not under my control. The software passes data as an argument to my script like ./bla.sh 'service;1234567890;ok;hostname;some text here' I need to pass the... (3 Replies)
Discussion started by: snoogie
3 Replies

5. Shell Programming and Scripting

Bash string manipulation

In my script I'm retrieving a parameter through an API call. I need to trim some things out of the result so I can use it as a parameter to pass to another process. I've got it working but it's pretty kludgy and I'm hoping someone can help me with a better way. This is the code that retrieves... (2 Replies)
Discussion started by: withanh
2 Replies

6. Shell Programming and Scripting

How do a distinct from a file using sort uniq in bash?

I have an output file .dat. From this file i have to do a distinct of the ID using the sort uniq command in bash script. How can i do it? i found : sort -u ${FILEOUT_DAT} but i don't think is my solution because the id isn't specified.. is there other solution? (7 Replies)
Discussion started by: punticci
7 Replies

7. Shell Programming and Scripting

Bash Integers/String

Hy friends, I am newbie to bash scripting, can anyone explain how b=${a/23/BB} # Substitute "BB" for "23". this line converts "b" into string and and "d" into Integer. Thanks in advance (4 Replies)
Discussion started by: Qazi
4 Replies

8. Shell Programming and Scripting

Bash: Getting first digit of a string

If i'm given a string like "abc-def-1.2.3", how would I return "1"? I'm new to scripting and got stumped on this problem. Thanks in advance! (7 Replies)
Discussion started by: atsim
7 Replies

9. UNIX for Beginners Questions & Answers

Escape bash-special character in a bash string

Hi, I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user... (5 Replies)
Discussion started by: arcoa05
5 Replies
XSIL2GRAPHICS(1)					User Contributed Perl Documentation					  XSIL2GRAPHICS(1)

NAME
xsil2graphics - generate scripts to load xsil output data files SYNOPSIS
xsil2graphics [options] <xsil_file> DESCRIPTION
Utility program bundled with xmds, used to generate scripts that load simulation output data into either matlab (http://www.mathworks.com) or scilab (http://www.scilab.org), which are then used to manipulate the results further if necessary and then to present the results graphically. Matlab To generate a matlab m-file, from the xsil file data_file.xsil use the command: bash$ xsil2graphics data_file.xsil or bash$ xsil2graphics --matlab data_file.xsil Then at the matlab command prompt: >> data_file Scilab To generate a scilab script file, from the xsil file data_file.xsil use the command: bash$ xsil2graphics --scilab data_file.xsil Then at the scilab command prompt: --> exec('data_file.sci') OPTIONS
-m, --matlab generate matlab m-file script to load data from the xsil data file (the default option) -s, -scilab generate scilab script file to load data from the xsil data file -o, --outfile <out_file> specify an alternative output script filename to the default which is the input xsil filename with the .xsil extension changed to either .m for the matlab m-file or .sci for the scilab script file EXAMPLES
bash$ xsil2graphics nlse.xsil Generates the output nlse.m to load the data into matlab bash$ xsil2graphics -m nlse.xsil Also generates the output nlse.m but explicitly sets matlab to be the output format bash$ xsil2graphics --scilab nlse.xsil Generates the output nlse.sci to load the data into scilab bash$ xsil2graphics --outfile nlse_new.m nlse.xsil Generates the output nlse_new.m to load the data into matlab AUTHORS
Originally written by Greg Collecutt Maintained by Paul Cochrane with code contributed by Joe Hope BUGS
No known bugs. SEE ALSO
xmds(1), loadxsil(1) http://www.xmds.org COPYRIGHT
Copyright (C) 2000-2004 Code contributed by Greg Collecutt, Joseph Hope and Paul Cochrane This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. perl v5.8.2 2004-06-21 XSIL2GRAPHICS(1)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy