Sponsored Content
Full Discussion: Parse a string as a command
Top Forums Shell Programming and Scripting Parse a string as a command Post 302541922 by yazu on Tuesday 26th of July 2011 07:06:45 AM
Old 07-26-2011
script.sh:
Code:
#!/bin/sh

txtshell=`./parser.sh /ews/MyEventHandler/data/handler/StopAndMail.php \
eventid=StopAndMail.MVIN.6300 lot_number=1122FXB facility=EWSF3        \
'mailto=prova.prova@nohost.com, prova.test@nohost.com' stop_oper=3000  \
stop_category=VISSPEC stop_step=MVIN 'message=Hold per QA (O.Tavilla)'`

echo "$txtshell"

parse.sh
Code:
#!/bin/sh
for param
do
        echo "Parameter: $param"
done

Code:
% ./script.sh
Parameter: /ews/MyEventHandler/data/handler/StopAndMail.php
Parameter: eventid=StopAndMail.MVIN.6300
Parameter: lot_number=1122FXB
Parameter: facility=EWSF3
Parameter: mailto=prova.prova@nohost.com, prova.test@nohost.com
Parameter: stop_oper=3000
Parameter: stop_category=VISSPEC
Parameter: stop_step=MVIN
Parameter: message=Hold per QA (O.Tavilla)

PS
I'm afraid I have not understood your code at once. Change $txtshell to eval "$txtshell" and your script should work.

Last edited by yazu; 07-26-2011 at 08:14 AM.. Reason: Oops
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

parse a string variable

Hello all, need a little help. I have an input variable such as ARGV which equals something like /use/home/name/script/test.dat I need to be able to get just the "test.dat" (i.e. the file name) at the end of the directory and the directory can be anything and any length. To put it another... (3 Replies)
Discussion started by: methos
3 Replies

2. Shell Programming and Scripting

String parse question

I have a string of data that looks like this: private.enterprises.954.1.1.1.1.1.2618 \(OctetString\): U private.enterprises.954.1.1.1.1.2.2618 \(OctetString\): 2618 I am trying to parse the string to only return the values after the ":". Ex from above "U" and "2618". Any suggestions? (5 Replies)
Discussion started by: mnreferee
5 Replies

3. Shell Programming and Scripting

how to parse this string

I want to get filenames from the following input. How can I parse this in bash. input data ------------------------------------------------------------------- path=/aaa/bbb/filename1;/aaa/filename2;/aaa/bbb/ccc/ddd/filename3 -------------------------------------------------------------------... (13 Replies)
Discussion started by: hcliff
13 Replies

4. Shell Programming and Scripting

Parse String from a Variable

Hello, Is there a quick way to parse the values from a variable? The variable has the following sample input: TA= The values of the TA variable is not fixed/hardcoded Basically I need to get the IV_Test and PF_SAPP_FWK values. I created a script that first use sed to remove ,... (3 Replies)
Discussion started by: racbern
3 Replies

5. Shell Programming and Scripting

How to parse a string efficiently

I am new to the boards and to shell programming and have a requirement to name new files received with a unique sequence number. I need to look at a particular file pattern that exists and then to increment a sequence by 1 and write the new file. Example of file names and sequence # ... (4 Replies)
Discussion started by: sandiego_coder
4 Replies

6. UNIX for Dummies Questions & Answers

parse string with awk

Hi Guys, I spend half a day getting this to work with no luck, perhaps you guys can help.. I have a string from a file looking like this: module::name=test::type=generic_data::exec=snmpget.......::desc=A Little Test::interval=300 what I would like to split it, so I get a value for each... (3 Replies)
Discussion started by: hyber
3 Replies

7. Shell Programming and Scripting

Parse string

Hi, I need to parse a string, check if there are periods and strip the string. For example i have the following domains and subdomains: mydomain.com, dev.mydomain.com I need to strip all periods so i have a string without periods or domain extensions: mydomain, devmydomain. I use this for... (12 Replies)
Discussion started by: ktm
12 Replies

8. Shell Programming and Scripting

AWK Command parse a file based on string.

AWK Command parse a file based on string. I am trying to write a shell script to parse a file based on a string and move the content of the file to another file. Here is scenario. File content below Mime-Version: 1.0 Content-Type: multipart/mixed; ... (2 Replies)
Discussion started by: aakishore
2 Replies

9. Shell Programming and Scripting

parse a mixed alphanumeric string from within a string

Hi, I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Discussion started by: keaneMB
2 Replies

10. Programming

Perl parse string

Hi Perl Guys I have another perl question I have the following code that i have written Getopt::Long::config(qw( permute bundling )); my $OPT = {}; GetOptions($OPT, qw( ver=s help|h )) or die "options parsing failed"; This will allow the user to do something like... (4 Replies)
Discussion started by: ab52
4 Replies
Configure::Writer(3pm)					User Contributed Perl Documentation				    Configure::Writer(3pm)

NAME
XMLTV::Configure::Writer - Configuration file writer for XMLTV grabbers DESCRIPTION
Utility class that helps grabbers write configuration descriptions. SYNOPSIS
use XMLTV::Configure::Writer; my $result; my $writer = new XMLTV::Writer::Configure( OUTPUT => $result, encoding => 'iso-8859-1' ); $writer->start( { grabber => 'tv_grab_xxx' } ); $writer->write_string( { id => 'username', title => [ [ 'Username', 'en' ], [ 'Anvaendarnamn', 'sv' ] ], description => [ [ 'The username for logging in to DataDirect.', 'en' ], [ 'Anvaendarnamn hos DataDirect', 'sv' ] ], } ); $writer->start_selectone( { id => 'lineup', title => [ [ 'Lineup', 'en' ], [ 'Programpaket', 'sv' ] ], description => [ [ 'The lineup of channels for your region.', 'en' ], [ 'Programpaket foer din region', 'sv' ] ], } ); $writer->write_option( { value=>'eastcoast', text=> => [ [ 'East Coast', 'en' ], [ 'Oestkusten', 'sv' ] ] } ); $writer->write_option( { value=>'westcoast', text=> => [ [ 'West Coast', 'en' ], [ 'Vaestkusten', 'sv' ] ] } ); $writer->end_selectone(); $writer->end(); print $result; EXPORTED FUNCTIONS
None. METHODS
start() Write the start of the <xmltvconfiguration> element. Parameter is a hashref which gives the attributes of this element. write_string() Write a <string> element. Parameter is a hashref with the data for the element: $writer->write_string( { id => 'username', title => [ [ 'Username', 'en' ], [ 'Anvaendarnamn', 'sv' ] ], description => [ [ 'The username for logging in to DataDirect.', 'en' ], [ 'Anvaendarnamn hos DataDirect', 'sv' ] ], default => "", } ); perl v5.14.2 2010-04-24 Configure::Writer(3pm)
All times are GMT -4. The time now is 12:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy