grep this no. 0100025144 and combine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep this no. 0100025144 and combine
# 1  
Old 02-04-2009
Network grep this no. 0100025144 and combine

<CRMSUB:MSIN=0100025144,BSNBC=TELEPHON-9814072360-TS11&TS21&TS22,NDC=9814
<ENTROPRSERV:MSIN=0100025144,OPRSERV=UCSI,UCSI=771-919814047117&775-919814047117;
<ENTRGCSERV:MSIN=0100025144,GCSERV=CALLWAIT-PROV&CALLHOLD&CLIP&HOTBILL&NATSS05,CLIPOVR=NO;
<ENTRCBSERV:MSIN=0100025144,CBSERV=CBOC,CCB=OPR,PW=0000;
<ENTRCBSERV:MSIN=0100025144,CBSERV=CBOIC,BSVG=TELEPHON;
<ENTRCFSERV:MSIN=0100025144,CFSERV=CFBUSY,NCS=NO,NFS=NO;
<ENTRCFSERV:MSIN=0100025144,CFSERV=CFNREPLY,NCS=NO,NFS=NO;
<ENTRCFSERV:MSIN=0100025144,CFSERV=CFNREACH,NCS=NO;
<ENTRCFSERV:MSIN=0100025144,CFSERV=CFU,NCS=NO;

this is my input file and i want it grep this no. 0100025144
and combine all these lines with in a single line

like
<CRMSUB:MSIN=0100025144,BSNBC=TELEPHON-9814072360-TS11&TS21&TS22,NDC=9814<ENTROPRSERV:MSIN=0100025144,OPRSERV=UCSI,UCSI=771-919814047117&775-919814047117;<ENTRGCSERV:MSIN=0100025144,GCSERV=CALLWAIT-PROV&CALLHOLD&CLIP&HOTBILL&NATSS05,CLIPOVR=NO;<ENTRCBSERV:MSIN=0100025144,CBSERV=CBOC,CCB=OPR,PW=000 0;<ENTRCBSERV:MSIN=0100025144,CBSERV=CBOIC,BSVG=TELEPHON;<ENTRCFSERV:MSIN=0100025144,CFSERV=CFBUSY,N CS=NO,NFS=NO;
# 2  
Old 02-04-2009
Code:
echo `
  grep $num file
  ` | sed -e 's/ //g'

or if the grep returns too much stuff:

Code:
grep $num file | tr '\012' ' ' | sed -e 's/ //g'


Last edited by quirkasaurus; 02-04-2009 at 11:42 AM.. Reason: heck, don't even need 'tr'
# 3  
Old 02-05-2009
in file records are a few lacks no.s meads file is too large

so i want that record of a single no. in a line
This is not a sufficient solution
# 4  
Old 02-05-2009
awk '{ printf( "%s", $0 ); }' file_in > file_out
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Can I combine below mentioned grep commands using OR (when searching strings having spaces)

Command 1: $script | grep 'Write to ECC( SSID=MARGIN)' Command 2: $script | grep 'is not greater than existing logical processing' The above commands run my script and search the mentioned strings but I do not want to run my script twice. It is increasing run time. Can someone tell me... (3 Replies)
Discussion started by: Tanu
3 Replies

2. Shell Programming and Scripting

Combine awk Or Grep Input

grep -ia '^Windows Installer' Galant01.txt Galant02.txt | awk -F '\t' '{print substr($1,1,index($1,":")) $4 "<br>"}' ; The output produces: Galant01.txt:Manual<br> Galant02.txt:Manual<br> It will be good to show instead: The output produces: Galant01.txt,Galant02.txt:Manual<br> The idea... (2 Replies)
Discussion started by: alvinoo
2 Replies

3. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

4. Shell Programming and Scripting

Combine two lists From Multiple Grep commands.

I'm working with a file with an xml structure. I'd like to parse it down to just the bits i want. Here is and example of the file <message id="96352877" method="status"> <date rfc="Sat, 12 Mar 2011 16:13:15 -0600" unix="1299967995" /> <services> <service id="facebook"... (4 Replies)
Discussion started by: Erulisseuiin
4 Replies

5. UNIX for Dummies Questions & Answers

combine -A and -v in grep

I have a data file that looks like this: infile: A 13 Z 23 F 22 Z 413 R 16how do I combine the -A option with the -v option to get the lines that don't match 'Z' and their next lines? the outfile should be: A 13 F 22 R 16I tried: (1 Reply)
Discussion started by: jdhahbi
1 Replies

6. Shell Programming and Scripting

combine

Hi I am having text file like this 001|ramu|hno221|>< sheshadripuram|delhi|560061>< 002|krishna|hno225|>< newdelhimain|delhi|560061>< i want to combine every two lines as single...line... i.e 001|ramu|hno221|sheshadripuram|delhi|560061 can u pls help me (3 Replies)
Discussion started by: suryanarayana
3 Replies

7. Shell Programming and Scripting

combine two grep statements

Hi I am wondering is it possible to combine two greps together I have two greps. grep "^,, *\." file (grep the line which has a '.' in the third column) grep "=" file (grep the line which has = anywhere) How to put them together so that if the content of the file that match either... (1 Reply)
Discussion started by: tiger66
1 Replies

8. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

9. Shell Programming and Scripting

sed, grep, cut or combine?

I am a beginner at shell scripting, actually i am working on my first script right now. Anyway i have searched the world how to grep two letters from each word (it will always just be two words). For example: Example Blablabla I want my script to cut out Ex (from the first word) and Bl... (4 Replies)
Discussion started by: maskot
4 Replies

10. UNIX for Dummies Questions & Answers

sed or grep or perl combine two lines

how do i search for the phrase "expected" on line one and "received" on line two. (there is a newline in between the two) I would like to know if/how this can be done in perl and/or grep and/or sed (3 Replies)
Discussion started by: artjaniger
3 Replies
Login or Register to Ask a Question