cat and grep not working


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users cat and grep not working
# 1  
Old 09-08-2008
cat and grep not working

I am trying to cat a file and then grep that file for a number. I can do it fine on other files but this particular file will not do anything. I tried running it on an older file from the same device but it is just not working. The file is nothing more than a flat file on a unix box. Here is just a excerpt from the file:

Code:
IS,1220765291,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252640,SIP,SIP,sip:2263735572@10.120.0.60:5060,13,NumB,F,NamB,F,Name,,SubExtn,,VarId,,BillCode,,CallingPartyType,2,PhNm,2263735572,CallType,Unknown,Rsid,e2d38bf4-1dd1-11b2-b99b-b03162323164,DEPT,,auth_ext,,auth_pin,,,PU,2263735572,,audio,cs-active,1
IS,1220765291,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e9ad66,8ae8375098bb9f65e27b33ada76964e4,11252641,SIP,convedia,,13,NumB,F,NamB,F,Name,,SubExtn,,CalledPartyType,2,PhNm,annc,CallAppType,,CallAppId,,CallType,Unknown,RedT,2,ClgSvcNm,,Rsid,e2d38bf4-1dd1-11b2-b99b-b03162323164,DEPT,,,PU,annc,,audio,cs-active,2
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252642,SIP,SIP,sip:2263735572@10.120.0.60:5060,0,NOTFOUND,0
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e9ad66,fe6fe8dae8c83ea31d0c37d767c07663,11252643,SIP,convedia,convedia01,0,NOTFOUND,0
ST,1220794274,f758e312-1dd1-11b2-b9a5-b03162323164,f759c390,52b0e6827e79cfb5a82c82f420126f94,11252740,SIP,SIP,sip:3194430507-ujg2cfog3lni8@10.120.1.100:5060,0,NORMAL,0

I tried grepping in several manners with no luck Any ideas?
# 2  
Old 09-08-2008
What did you try? What did it say? Errors? More info please.
# 3  
Old 09-08-2008
if I enter in cat filename | grep 'searched text' it comes back with nothing
if I enter in grep 'searched text' filename it comes back with nothing

Its not giving any errors. I can do it on other files just fine. It is very strange.
# 4  
Old 09-08-2008
Code:
# cat ll.txt

IS,1220765291,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252640,SIP,SIP,sip:2263735572@10.120.0.60:5
060,13,NumB,F,NamB,F,Name,,SubExtn,,VarId,,BillCode,,CallingPartyType,2,PhNm,2263735572,CallType,Unk
nown,Rsid,e2d38bf4-1dd1-11b2-b99b-b03162323164,DEPT,,auth_ext,,auth_pin,,,PU,2263735572,,audio,cs-active,1
IS,1220765291,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e9ad66,8ae8375098bb9f65e27b33ada76964e4,11252641,SIP,convedia,,13,NumB,F,NamB,F,Name,
,SubExtn,,CalledPartyType,2,PhNm,annc,CallAppType,,CallAppId,,CallType,Unknown,RedT,2,ClgSvcNm,,Rsid
,e2d38bf4-1dd1-11b2-b99b-b03162323164,DEPT,,,PU,annc,,audio,cs-active,2
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252642,SIP,SIP,sip:2263735572@10.120.0.60:5
060,0,NOTFOUND,0
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e9ad66,fe6fe8dae8c83ea31d0c37d767c07663,11252643,SIP,convedia,convedia01,0,NOTFOUND,0
ST,1220794274,f758e312-1dd1-11b2-b9a5-b03162323164,f759c390,52b0e6827e79cfb5a82c82f420126f94,11252740,SIP,SIP,sip:3194430507-ujg2cfog3lni8@10.120.1.100:5060,0,NORMAL,0


# cat ll.txt | grep 11252642
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252642,SIP,SIP,sip:2263735572@10.120.0.60:5

# grep "11252642" ll.txt
ST,1220765298,c2e8e7b4-1dd1-11b2-b9a0-b03162323164,c2e8e7b4,31682826ca58247fdd2326c5315f8150,11252642,SIP,SIP,sip:2263735572@10.120.0.60:5

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

BCP with cat not working

Hello, I am facing a typical problem in my code . If I run bcp alone it is working fine if I run BCP with cat it is not working . Not able to find where the error is occurring in cat . Can you please help bcp ${_DBName}..logfile in ${_currdate} -f$PANEL_HOME/format/logfile.fmt -Q -U$_UserId... (11 Replies)
Discussion started by: arunkumar_mca
11 Replies

2. UNIX for Dummies Questions & Answers

Grep or cat The Whole Directory PROBLEMS :(

Hi Guys This is my first post so I am not sure how things go here. I'm sorry if I'm breaking the rule or something. Feel free to correct me about that :) So as I was saying... I'd been trying to grep this folder containing 900,000 txt files but seems no luck. I get either "No such file... (6 Replies)
Discussion started by: Nexeu
6 Replies

3. Shell Programming and Scripting

Cat command not working to display Mac file in Ubuntu

Hi, Recently I got a .txt file from Mac user. when I try to open it in my Ubuntu machine using cat command it is not displaying any content of file however I can see the content using vi. Anyone know How to see its content using cat as I have to process it in my shell script. Thanks in... (4 Replies)
Discussion started by: diehard
4 Replies

4. Shell Programming and Scripting

Incredibly inefficient cat | grep script

Hi there, I have 2 files that I am trying to work on. File 1 contains a reference list of unique subscriber numbers ( 7 million entries in total) File 2 contains a list of the subscriber numbers and their tariff (15 million entries in total). This file is in the production system and... (12 Replies)
Discussion started by: Cludgie
12 Replies

5. Shell Programming and Scripting

Replace cat and grep with <

Hello someone told me to use OS=`awk '{print int($3)}' < /etc/redhat-release` instead of OS=cat /etc/redhat-release | `awk '{print int($3)}'` any idea for the reason ? (5 Replies)
Discussion started by: nimafire
5 Replies

6. UNIX for Dummies Questions & Answers

Grep and cat combined

Hello, i need to search one word (snp1) from many files and copy the content of the columns of this word in new file. example: file 1: SNP BP CHR P snp1 1 3 0.01 snp2 2 2 0.05 . . file 2: SNP BP CHR P snp1 1 3 0.06 snp2 2 2 0.3 output... (6 Replies)
Discussion started by: biopsy
6 Replies

7. Shell Programming and Scripting

grep or cat using sed

Is there a way using grep or cat a file to create a new file based on whether the first 9 positions of each record is less than 399999999? This is a fixed file format. (3 Replies)
Discussion started by: ski
3 Replies

8. Shell Programming and Scripting

cat -n and grep

I am not sure if using cat -n is the most efficient way to split a file into multiple files, one file per line in the source file. I thought using cat -n would make it easy to process the file because it produces an output that numbers each line that I could then grep for with the regex "^ *$i".... (3 Replies)
Discussion started by: kapu
3 Replies

9. Shell Programming and Scripting

cat /etc/passwd and grep -v on /etc/shells

Hi All, I'd like to do this cat /etc/passwd and grep -v on the /etc/shells list I'd like to find all shell that doesn't exist on the /etc/passwd. Is there an easy way without doing a egrep -v "/bin/sh|/bin/bash................"? How do I use a file /etc/shells as my list for... (4 Replies)
Discussion started by: itik
4 Replies

10. OS X (Apple)

Cat command not working as expected

I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction. I'm... (10 Replies)
Discussion started by: Daniel M. Clark
10 Replies
Login or Register to Ask a Question