Output of both the echo statement in one line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output of both the echo statement in one line
# 1  
Old 09-22-2008
Output of both the echo statement in one line

I have script like


echo
-n FINISHED FEXP: ${TABLE2EXP}
echo $STATUS


I want the output of both the echo statement in one line


How can i do this
# 2  
Old 09-22-2008
Enclose the strings in double quote and at the end of first echo add a "\c"


Code:
echo "FINISHED FEXP: ${TABLE2EXP}  \C"
echo "$STATUS"

# 3  
Old 09-22-2008
when I am giving like this

STATUS= cat temp1 | grep "Highest return code encountered" | cut -d " " -f13,14,15,16,17,18
echo "FINISHED FEXP: ${TABLE2EXP}\c"
echo "$STATUS"









i am getting ooutptu as

Highest return code encountered = '0'.
FINISHED FEXP: ccc_conduit_gci




why its coming in different order , it should be like

FINISHED FEXP: ccc_conduit_gci
Highest return code encountered = '0'.

and even its not coming in one line
# 4  
Old 09-22-2008
Because you are not assigning the STATUS correctly. To capture the value of a command into a variable, use backticks (grave accents, ASCII 96) or $(command)

The simplest and most portable solution to your original problem is to put all the information in a single echo.

Code:
STATUS=$(grep "Highest return code encountered" temp1 | cut -d " " -f13,14,15,16,17,18)
echo "FINISHED FEXP: ${TABLE2EXP} $STATUS"

I also took out the Useless Use of Cat -- grep knows full well how to read a file, you don't need cat for that.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep echo awk print all output on one line

Hello, I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it. I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Discussion started by: rwalker
51 Replies

2. Shell Programming and Scripting

BASH - Need to echo for loop output to one line

I'm trying to echo the release version of some of our Linux servers. Typically I do these types of things by "catting" a text file with the host names, "ssh-ing" to the host and running my string. This is what I've written for i in `cat versions.txt` ; do echo $i ; ssh $i cat /etc/issue |... (5 Replies)
Discussion started by: lombardi4851
5 Replies

3. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

4. Shell Programming and Scripting

echo two command output in the same line

Hi, I try to write script and echo two command at the same line . echo "A" echo "B" How can I pipe above two command at the same line in text file . So, in the output text file , you can see below ??? A B not A B Any sugggestion ??? (4 Replies)
Discussion started by: chuikingman
4 Replies

5. Shell Programming and Scripting

Echo and a command's output on the same line

Hello, I'm writing some bash scripts and I'm trying to get an echo command and the output of another command to display on the same line. For example: I want to run echo "Operating System: " unameand have it displayed as Operating System: Darwin Thanks for your help! (7 Replies)
Discussion started by: codyhazelwood
7 Replies

6. Shell Programming and Scripting

concatinate a string with output of echo statement

I need to concatinate a string (mapping-expression) with the output of below statement EXPRESS="cat //normalization-binding//tag-normalization/tag-name" echo $EXPRESS | xmllint --shell QA_Oct12_DIR.cfb | grep -v "/ >" >> "/home/testBinding.txt" above statement write value="$6061" into... (1 Reply)
Discussion started by: bkc
1 Replies

7. Shell Programming and Scripting

setting width in echo statement

Hello All, I need to set the width or number of columns for my dynamic output in the echo statement. statement is like: echo " <output> " here the <output> is dyamice and can be of any number of characters, the " " should always start in same column everytime it is... (4 Replies)
Discussion started by: s123.radha
4 Replies

8. Shell Programming and Scripting

echo statement issue

Hi All, I am pasting my code below if # e means file exists then echo OFR_Configlist exists >> OFR_Backup_Configfiles.log else echo OFR_Configlist Not exists >> OFR_Backup_Configfiles.log exit fi How can i show the echo message in console also at the same time? I dont want to write... (3 Replies)
Discussion started by: subin_bala
3 Replies

9. Shell Programming and Scripting

echo statement

Does anyone know the correct syntax for computing arithmetic expressions inside the echo statement? Let me know, thanks (3 Replies)
Discussion started by: circleW
3 Replies

10. Shell Programming and Scripting

How to place the output of two different echo statements on one line

Hello there, I wrote a shell script to modify the code for some of our clients in our client database. Before starting the data modification the program performs a few checks. When a check is being performed, it should be shown on the screen of the user running the program, the result of... (5 Replies)
Discussion started by: JoBa
5 Replies
Login or Register to Ask a Question