Display the output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display the output
# 1  
Old 10-10-2013
Display the output

Hi,


I have the following output of a shell script
Code:
k m == [76 frames] -77.2820 [Ac=-5633.4 LM=-240.0] (Act=79.9)

i want to display only

Code:
k m


Last edited by Don Cragun; 10-10-2013 at 11:58 PM.. Reason: Use CODE tags for sample input, sample output, and code segments only...
# 2  
Old 10-10-2013
What do you mean by only k m as output.. Do you want the only the first field if before "==" then
Code:
echo "whateveroutput" +awk |F[=][=] '{print $1}'

# 3  
Old 10-11-2013
yes rathheeshjulk
when i ran the code i got the error message
F[=][=]: command not found
# 4  
Old 10-11-2013
If you really just want to display only:
Code:
k m

the script:
Code:
echo k m

will do what you want. If you're trying to create a filter that will extract some data from the output of another script, you need to give us a much better description of what you're trying to do.
# 5  
Old 10-11-2013
Don Cragun,
I want to display characters before ==
# 6  
Old 10-11-2013
Assuming you're using a POSIX conforming shell, try:
Code:
while read -r line
do      printf "%s\n" "${line%%==*}"
done

# 7  
Old 10-11-2013
Code:
your_output | awk -F'=' '{print $1}'


Last edited by Scott; 11-18-2013 at 10:14 AM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display output by joining two files

1.txt A B C D 2nd file: 2.txt 1 2 3 4 Output that I want to get: A1 B2 C3 D4 How to get this output using awk command (5 Replies)
Discussion started by: sidpatil
5 Replies

2. Homework & Coursework Questions

Using ls or echo to display a specific output

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: What single command line would you enter to get the following output? 8140 drwxr-xr-x 9 root bin 18 Jan 20... (6 Replies)
Discussion started by: dasboot
6 Replies

3. Shell Programming and Scripting

Display output bash program

Hello, i have a problem with the output from my bash program. I made this program #!/bin/bash BESTANDEN=$* # Plaatst bestanden in de variabele BESTANDEN TMPFILE=xmlprog.sh.$$.$RANDOM # basisnaam voor tijdelijke bestanden # controller of het programma correct is aangeroepen if then ... (6 Replies)
Discussion started by: dutchspiders
6 Replies

4. Shell Programming and Scripting

Need to display the output of ls -l selected columns

Hello Friends, Hope you are doing well. I am writing a shell script to find out the log file which are not updated in last 1 hours. I've almost completed the script but need your help in formatting its outputs. Currently, the output of the script is like this(as a flat row): ... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

5. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

6. UNIX for Dummies Questions & Answers

Display output of one xterm on another

Setup: Two users, each likely on Windows PCs, using either putty or SecureCRT to connect to a remote Solaris server. The connection could be either telnet or ssh. Wanted: How can the output of one users xterm be directed to the other user so that you can easily allow someone to see what... (8 Replies)
Discussion started by: Vi-Curious
8 Replies

7. UNIX for Dummies Questions & Answers

Display multiple output lines

All, I have a file ABC.TXT which has two records: 12345 19.93 34.94 12345 94.84 10.48 If do the following command and grep '12345' ABC.TXT >> test1.txt If I look at the output of test1.txt I appears as follows: 12345 19.93 34.94 12345 94.84 10.48 I... (5 Replies)
Discussion started by: kingofprussia
5 Replies

8. Shell Programming and Scripting

display and output...question

Hi, I have a small question about the value cannot display correctly: MSG=log fruit=apple print "No $fruit in the store" > "$MSG/fruit_message.txt" output: No $fruit in the store should be: No apple in the store AND $MSG/fruit_message.txt ----------> cannot find the... (5 Replies)
Discussion started by: happyv
5 Replies

9. Shell Programming and Scripting

To display 1 or 2 space bar output

Dear Experts, Please help to advice me for the command to show the output below:- 1) If i input 3, 201, 222 then the output should show 1 space bar as below 201 222 2) If i input 4, 201, 1509 then the outpur should show 2 span bar as below 201 1509 3 will be for 1 space bar between 201... (2 Replies)
Discussion started by: missutoomuch
2 Replies

10. Shell Programming and Scripting

output display alignment !!

Hi I'm trying to display the output of my script in a friendly viewable format. it's something like this.. i have this while loop... in which i get some records from a file where fields are delimitered with a pipe. so i'm extacting each field and replacing the pipe with a \t, tab !!.. cat... (7 Replies)
Discussion started by: rosh0623
7 Replies
Login or Register to Ask a Question