Take quoted output from one script as quoted input for another script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Take quoted output from one script as quoted input for another script
# 1  
Old 12-06-2011
Take quoted output from one script as quoted input for another script

Hi,

I have a script output.sh which produces the following output (as an example):
"abc def" "ghi jkl"

This output should be handled from script input.sh as input and the quotes should be treated as variable delimiters but not as regular characters.

input.sh (processing positional parameters)
Code:
  VAR1=$1
  VAR2=$2
  echo $VAR1
  echo $VAR2

If I do this one: input.sh `output.sh`
I get this result:
"abc
def"

But that's not exactly what I hoped to see:
abc def
ghi jkl

How can I make Script input.sh to handle the output of output.sh as needed, i. e. by using the delivered quotes as variable delimiters?

Thanks in adance,
Stephan.

Last edited by stresing; 12-06-2011 at 01:22 PM..
# 2  
Old 12-06-2011
Try this...
Code:
./output.sh | xargs ./input.sh

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 12-07-2011
Oh, yes, sometimes life can be really easy! :-) But sometimes I can't see the wood for the (christmas) trees... Smilie

Thank you!

Stephan
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue handling single quoted argument in shell script.

Below is my script that works fine and prints the desired output: #!/bin/ksh echo "$1" | while IFS= read -r dirpath do echo "DIRR_PATH:$dirpath" install_dir=$install_dir" "$dirpath done echo "Desired Output:$install_dir" Output: ./loopissue.sh... (10 Replies)
Discussion started by: mohtashims
10 Replies

2. Shell Programming and Scripting

Shell Script Help..Renaming Quoted files removing the timestamp

Hi all, i am new to this forum, unix and shell scripting. I would really appreciate if you all can help me here.. I have files coming in the below format 'filename20513'13May06:03:45 filename are characters.. like 'ABDDUT20513'13May06:03:45 i need it to be renamed as... (17 Replies)
Discussion started by: khman
17 Replies

3. Shell Programming and Scripting

Problem with quoted path in script

I've tried various permutations of quoting this path in a shell script to no avail: /Users/bernie/Pictures/camera/Bernie\'s\ iPhone/Camera\ Roll Here are some of the quoting/escaped paths I've tried: ##SrcPath="/Users/bernie/Pictures/camera/Bernie's\ iPhone/Camera\ Roll"... (2 Replies)
Discussion started by: zBernie
2 Replies

4. Shell Programming and Scripting

How to ignore quoted separators

Hi, I'm trying to parse a text file which uses commas as field separators. Fields are double quoted, and may themselves contain commas, like this: "1","John Smith","London","123" "2","Mary Robertson","Horsham, Sussex","456" This causes problems for the following command cut -d","... (7 Replies)
Discussion started by: sven44
7 Replies

5. UNIX for Dummies Questions & Answers

grep quoted numbers from lines

I want to parse the lines and want to extract the double quoted numbers as: "SQL3149N "72" rows were processed from the input file. "0" rows were successfully inserted into the table. "0" rows were rejected." and want the output in 3 variables like a=72 b=0 c=0 thanks in advance ... (3 Replies)
Discussion started by: mahesh_191
3 Replies

6. UNIX for Dummies Questions & Answers

Count Fields with Quoted Field

Hi, I used to count number of fields using following command head -1 <filename> | awk -F"," '{print NF}' Now the scenario is the delimiter(comma) occurs inside one of the data field. How to ignore the comma inside data and consider only delimiter and count number of fields. The fields are... (1 Reply)
Discussion started by: ethanr100
1 Replies

7. Shell Programming and Scripting

Unterminated quoted string

Hello! I wroted a little script that should check for new updates on a server and get them if any. The problem is, every time I run it with sh, I'm getting an "script: 20: Syntax error: Unterminated quoted string" error! The problem is, there isn't any "unterminated quoted string" in my script:... (2 Replies)
Discussion started by: al0x
2 Replies

8. Shell Programming and Scripting

can quoted text return values

Hi All, index=10.5 let "res = $index + 1.7" echo "res = $res" Can anybody explain what this piece of code does. (7 Replies)
Discussion started by: kinny
7 Replies

9. Shell Programming and Scripting

odd behaviour with quoted input strings

I'm working with a java-based monitoring tool (Solaris/x86) which can be configured to call a shell script when a particular event occurs. The java app sends a set of quoted strings as input to the shell script. The problem I'm running into is that the shell script, when called by the java app,... (0 Replies)
Discussion started by: iron_horse
0 Replies

10. Shell Programming and Scripting

awk search for Quoted strings (')

Hi All, I have files: 1. abc.sql 'This is a sample file for testing' This does not have quotations this also does not have quotations. and this 'has quotations'. here I need to list the hard coded strings 'This is a sample file for testing' and 'has quotations'. So i have... (13 Replies)
Discussion started by: kprattip
13 Replies
Login or Register to Ask a Question