grep result in newline


 
Thread Tools Search this Thread
Operating Systems Solaris grep result in newline
# 1  
Old 01-18-2012
grep result in newline

Hi

While trying to do a search on solaris, the grep results seems to be appearing on the same line instead of the new line.


Code:
Wed Jan 18 14:45:48 weblogic@test:/abcd$ grep qainejb02 *
qa_cluster_biz_view_tc_intl_servers_ports_2:qainejb02 7101
qa_cluster_servers_2:qainejb02
qa_intl_biz_servers:qainejb02qa_intl_biz_servers_and_ports:qainejb02 7101Wed Jan 18 14:45:51 weblogic@test:/abcd$

wherein the actual display must have been like below

Code:
Wed Jan 18 14:45:48 weblogic@test:/abcd$ grep qainejb02 *
qa_cluster_biz_view_tc_intl_servers_ports_2:qainejb02 7101
qa_cluster_servers_2:qainejb02
qa_intl_biz_servers:qainejb02
qa_intl_biz_servers_and_ports:qainejb02 7101
Wed Jan 18 14:45:51 weblogic@test:/abcd$

I also tried to frame the grep with cat command, but that doesnt work either. Could someone help me here.. thanks
# 2  
Old 01-18-2012
What grep command are you using? Please post it.
And. Does the file really have newlines or just a lot of padding spaces so that it formats well on a given terminal width setting? Example - the interface to Microfocus COBOL licensing does this.
# 3  
Old 01-18-2012
What grep command are you using? Please post it.
And. Does the file really have newlines or just a lot of padding spaces so that it formats well on a given terminal width setting? Example - the interface to Microfocus COBOL licensing does this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert newline when grep result is empty

Given a csv file with 40 columns with name, address, hometown etc. I use a bash command in 1 line which: 1. gets the address column and pipes that to 2. grep the first digit and everything that follows Command: awk -F ";" '{print $19}' /Users/jb/Desktop/ReorderTempTotal.csv | grep -o "\d.*"... (7 Replies)
Discussion started by: JBVeenstra
7 Replies

2. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

3. Shell Programming and Scripting

pipe result from grep

Trying to create a command line script to look for all files matching a pattern, grep for a specific value in each file, and write out the filename long list. It's possible the filename won't containe the value. { echo “Running....” for fname in 811_Intermediate_File_* do grep -l... (3 Replies)
Discussion started by: gavineq
3 Replies

4. UNIX for Dummies Questions & Answers

Is it possible to grep with a newline in the middle of an expression?

I'm hoping that there is a way to do this. I'm sure I won't be able to get the answer I need on the deadline I need it...but at least I'll learn how to solve this problem. I have a file that looks like this: (00:14:25\$ head -27 QNHDSPACEDVR Name: PollDhctAVFSInfo 00:0F:21:4B:00:6A Name:... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

5. Shell Programming and Scripting

How to negate grep result?

Here is my script so far: set dirs = ` find . -name "message.jar" 2> /dev/null | cut -d "/" -f 2 ` | uniq foreach dir ( $dirs ) if (grep $dir/* someText==null) --> how do I write this in script? print $dir end end (4 Replies)
Discussion started by: mmdawg
4 Replies

6. Shell Programming and Scripting

diaplaying the grep result

Hi, My code is like this if swlist -a revision 2>/dev/null | grep ABC 2>/dev/null then echo "Found Above mentioned ABC Version, please remove it first..." fi This is displaying the result to the screen. i want to first suppress that and for that i wrote the below... (1 Reply)
Discussion started by: rag84dec
1 Replies

7. Shell Programming and Scripting

how to keep newline characters in command execution result?

I found that when I used a variable to receive the result from a command execution, the newline characters were removed from the variable. For example, I ran $ ret=`ls -l` $ echo $ret Then, I saw: total 40 -rw-r--r-- 1 testtrunk testtrunk 0 Dec 13 11:13 pk -rw-rw-r-- 1 testtrunk... (2 Replies)
Discussion started by: pankai
2 Replies

8. Shell Programming and Scripting

grep the pattern followed by newline

Hi I have a problem using grep to find a pattern followed by newline. Here is my file xxxxxxxxxxxpattern patternxxxxxx pattern xxxpattern xxpatternx xxxxxxyyyyxxxx I want the result to be like this xxxxxxxxxxxpattern pattern xxxpattern Please help (2 Replies)
Discussion started by: lalelle
2 Replies

9. UNIX for Dummies Questions & Answers

To have a numeric result from grep

I am new to unix. i need to know how to use grep to grep and expression from a file. and pass the result as a 0 for found and 1 for not found. I can only go up to grep 'Checking Subscription Status' ranos.log. Please help. Thank you. (2 Replies)
Discussion started by: Hak Dee
2 Replies

10. Shell Programming and Scripting

grep and sed to find a pattern and add newline

Hello All, I have log file the result from a multithreaded process. So when a process finishes it will write to this log file as 123 rows merged. The issue is sometimes the processess finish at the same time or write to the file at the same time as 123 rows merged.145 rows merged. At... (5 Replies)
Discussion started by: ssikhar
5 Replies
Login or Register to Ask a Question