Grep: writing output: Connection reset by peer


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Grep: writing output: Connection reset by peer
# 1  
Old 06-18-2013
Grep: writing output: Connection reset by peer

Hi ,

when i run ,

Code:
 tkt=/u01/ctrlfile/tkt.tmp
grep "TICKET NBR" $cdrFile | head -$count | tail -1 > $tkt

i got error
Code:
grep: writing output: Connection reset by peer

but some time its working withour error its working fine but some time i got this error

any help please

Last edited by OTNA; 06-19-2013 at 09:23 AM..
# 2  
Old 06-18-2013
I guess this is only half the truth, and you are working on a remote node. The error msg indicates some network problem. Is your output file on a remotely mounted drive? Or is your pwd on such a drive?
# 3  
Old 06-19-2013
Hi ,

yes exactly i'm working throw ssh on a remote server , i've changed the output to be on the same Script location but stills same error , by the way i'm loged on the server throw ssh and run the script on the same server and the output on the same server , nothing related to network i guess
# 4  
Old 06-19-2013
"Connection reset by peer" is the typical msg if troubles with the network and the connection is lost!
# 5  
Old 06-19-2013
i'm working on the same server there is no network connection with others

---------- Post updated at 08:16 AM ---------- Previous update was at 08:12 AM ----------



Hi ,

really this is the problem , i'm working on the same server file on the same server only grep file and send the output on the file on the same path on the same server ,

---------- Post updated at 07:41 AM ---------- Previous update was at 07:21 AM ----------


tkt=/u01/ctrlfile/tkt.tmp
grep "TICKET NBR" $cdrFile | head -$count | tail -1 > $tkt


really the result of the grep is to get the TAG number with all content , i dont know if there is better way to get this TAG with contents , i have CDR with about 100 tags each TAG is like below , i need to get one by one , so the $count represents the number of TAG


! TICKET NBR : 13 ! GSI : 102 ! 3100.2.112.1 11/06/2013 15:57:50 ! 3100.2.22.3 0 ! 3100.2.137.4 665002145 ! 3100.2.22.8 VOIP ! 3100.2.97.1 192.168.0.12 ! 3100.2.19.2 665002145 ! 3100.2.22.2 7 ! 3100.2.70.8 1030 ! 3100.2.128.2 66 ! 3100.2.70.2 0a8d192c;21770d56;418666605002145-00260615 ! 3100.2.18.1 0 ! 3100.2.22.1 189 ! 3100.2.70.11 016c6f63000431333000 ! 3100.2.128.1 418 ! 3100.2.137.2 2 ! 3100.2.70.1 mscp02.ebl-pgw01-epc1 ! 3100.2.19.6 665002145 ! 3100.2.34.2 00:00:00 ! 3100.2.136.1 4186603e90043e03 ! 3100.2.137.1 665002145 ! 1.2.1.5 11/06/2013 16:09:46 ! 3100.2.19.5 418666605002145 ! 3100.2.34.1 11/06/2013 16:09:46 ! 3100.2.40.1 0 ! 3100.2.41.1 d5619d50000001090000010e ! 3100.2.10.11 8660890118255104 ! 3100.2.22.4 0 ! 3100.2.70.14 10.32251@3gpp.org ! 3100.2.137.5 1 ! 3100.2.134.1 1 ! 3100.2.133.1 665002145 ! 3100.2.105.1 Newroz_Data_SO ! 3100.2.105.6 sdpprov ! 3100.2.105.2 Newroz_CO ! 3100.2.134.3 1 ! 3100.2.104.4 665002145 ! 3100.2.28.5 10 ! 3100.2.44.1 Basic ! 3100.2.28.4 2 ! 3100.2.29.4 Kilobyte ! 3100.2.104.5 665002145 ! 3100.2.28.24 05/06/2014 15:59:11 ! 3100.2.28.23 08/09/2013 15:59:11 ! 3100.2.142.3 0 ! 3100.2.28.2 10 ! 3100.2.29.2 second ! 3100.2.140.2 13 ! 3100.2.24.1 0 ! 3100.2.142.2 13 ! 3100.2.28.1 2 ! 3100.2.103.2 1 ! 3100.2.140.1 720 ! 3100.2.104.2 418666605002145 ! 3100.2.142.1 720 ! 3100.2.100.1 1 ! 3100.2.29.6 event ! 3100.2.139.1 0 ! 3100.2.134.11 1 ! 3100.2.106.10 Tariff_Fixed_1x1x1 - v1.0 ! 3100.2.106.1 Tariff_Fixed_1x1x1 ! 3100.2.140.8 13 ! 3100.2.140.7 720 ! 3100.2.142.12 13 ! 3100.2.142.11 720 ! 3100.2.134.13 0 ! 3100.2.124.1 default_balance ! 3100.2.124.9 Money ! 3100.2.124.3 0 ! 3100.2.124.8 0 ! 3100.2.140.4 720 ! 3100.2.124.2 0 ! 3100.2.134.14 0 ! 3100.2.134.13 0 ! 3100.2.124.1 bundle_activation ! 3100.2.124.9 Quantity ! 3100.2.140.5 13 ! 3100.2.124.3 8802230 ! 3100.2.124.8 8802243 ! 3100.2.124.2 13 ! 3100.2.124.34 13 ! 3100.2.134.14 0 ! 3100.2.134.12 1 ! 3100.2.134.4 1 ! 3100.2.134.2 1 !


i think the problem is with the script itself

---------- Post updated at 07:53 AM ---------- Previous update was at 07:41 AM ----------

this is sample of 2 TAGs of 170 TAGs in the one CDRs

! HISTORICAL DATA ! ONE FILE DECODING REPORT ! SERVICE : ce20 ! FILE : /osp/psmf/service/ce20/accounting/acc16258167_0030 !
! TICKET NBR : 1 ! GSI : 102 ! 3100.2.112.1 11/06/2013 15:56:29 ! 3100.2.22.3 0 ! 3100.2.137.4 665002231 ! 3100.2.22.8 VOIP ! 3100.2.97.1 192.168.0.12 ! 3100.2.19.2 665002231 ! 3100.2.22.2 7 ! 3100.2.70.8 1030 ! 3100.2.128.2 66 ! 3100.2.70.2 1a0f0cfd;2377005d;418666605002231-00250635 ! 3100.2.18.1 0 ! 3100.2.22.1 189 ! 3100.2.70.11 016c6f63000431333000 ! 3100.2.128.1 418 ! 3100.2.137.2 2 ! 3100.2.70.1 mscp02.ebl-pgw01-epc1 ! 3100.2.19.6 665002231 ! 3100.2.34.2 00:00:00 ! 3100.2.136.1 4186603ed0041c03 ! 3100.2.137.1 665002231 ! 1.2.1.5 11/06/2013 16:09:25 ! 3100.2.19.5 418666605002231 ! 3100.2.34.1 11/06/2013 16:09:25 ! 3100.2.40.1 0 ! 3100.2.41.1 d5619cff00000108000000e4 ! 3100.2.10.11 8660890118244904 ! 3100.2.22.4 0 ! 3100.2.137.5 1 ! 3100.2.134.1 1 ! 3100.2.133.1 665002231 ! 3100.2.105.1 Newroz_Data_SO ! 3100.2.105.6 sdpprov ! 3100.2.105.2 Newroz_CO ! 3100.2.134.3 1 ! 3100.2.104.4 665002231 ! 3100.2.28.5 10 ! 3100.2.44.1 Basic ! 3100.2.28.4 2 ! 3100.2.29.4 Kilobyte ! 3100.2.104.5 665002231 ! 3100.2.28.24 05/06/2014 12:08:01 ! 3100.2.28.23 08/09/2013 12:08:01 ! 3100.2.142.3 0 ! 3100.2.28.2 10 ! 3100.2.29.2 second ! 3100.2.140.2 13 ! 3100.2.24.1 0 ! 3100.2.142.2 13 ! 3100.2.28.1 2 ! 3100.2.103.2 1 ! 3100.2.140.1 780 ! 3100.2.104.2 418666605002231 ! 3100.2.142.1 780 ! 3100.2.100.1 1 ! 3100.2.29.6 event ! 3100.2.139.1 0 ! 3100.2.134.11 1 ! 3100.2.106.10 Tariff_Fixed_1x1x1 - v1.0 ! 3100.2.106.1 Tariff_Fixed_1x1x1 ! 3100.2.140.8 13 ! 3100.2.140.7 780 ! 3100.2.142.12 13 ! 3100.2.142.11 780 ! 3100.2.134.13 0 ! 3100.2.124.1 default_balance ! 3100.2.124.9 Money ! 3100.2.124.3 0 ! 3100.2.124.8 0 ! 3100.2.140.4 780 ! 3100.2.124.2 0 ! 3100.2.134.14 0 ! 3100.2.134.13 0 ! 3100.2.124.1 bundle_activation ! 3100.2.124.9 Quantity ! 3100.2.140.5 13 ! 3100.2.124.3 10052772 ! 3100.2.124.8 10052786 ! 3100.2.124.2 13 ! 3100.2.124.34 13 ! 3100.2.134.14 0 ! 3100.2.134.12 1 ! 3100.2.134.4 1 ! 3100.2.134.2 1 !
! TICKET NBR : 2 ! GSI : 102 ! 3100.2.112.1 11/06/2013 16:00:45 ! 3100.2.22.3 0 ! 3100.2.137.4 665000902 ! 3100.2.22.8 Browsing ! 3100.2.97.1 192.168.0.12 ! 3100.2.19.2 665000902 ! 3100.2.22.2 7 ! 3100.2.70.8 1020 ! 3100.2.128.2 66 ! 3100.2.70.2 078fe1d8;18b6bdce;418666605000902-002c0385 ! 3100.2.18.1 0 ! 3100.2.22.1 189 ! 3100.2.70.11 016c6f63000431333000 ! 3100.2.128.1 418 ! 3100.2.137.2 2 ! 3100.2.70.1 mscp01.ebl-pgw01-epc1 ! 3100.2.19.6 665000902 ! 3100.2.34.2 00:00:00 ! 3100.2.136.1 4186603ee0045e01 ! 3100.2.137.1 665000902 ! 1.2.1.5 11/06/2013 16:09:26 ! 3100.2.19.5 418666605000902 ! 3100.2.34.1 11/06/2013 16:09:26 ! 3100.2.40.1 0 ! 3100.2.41.1 d5619dfd0000011300000423 ! 3100.2.10.11 8660890117969504 ! 3100.2.22.4 0 ! 3100.2.137.5 1 ! 3100.2.134.1 1 ! 3100.2.133.1 665000902 ! 3100.2.105.1 Newroz_Data_SO ! 3100.2.105.6 sdpprov ! 3100.2.105.2 Newroz_CO ! 3100.2.134.3 1 ! 3100.2.104.4 665000902 ! 3100.2.28.5 10 ! 3100.2.44.1 Basic ! 3100.2.28.4 2 ! 3100.2.29.4 Kilobyte ! 3100.2.104.5 665000902 ! 3100.2.28.24 01/06/2014 22:28:56 ! 3100.2.28.23 04/09/2013 22:28:56 ! 3100.2.142.3 0 ! 3100.2.28.2 10 ! 3100.2.29.2 second ! 3100.2.140.2 1 ! 3100.2.24.1 0 ! 3100.2.142.2 1 ! 3100.2.28.1 2 ! 3100.2.103.2 1 ! 3100.2.140.1 540 ! 3100.2.104.2 418666605000902 ! 3100.2.142.1 540 ! 3100.2.100.1 1 ! 3100.2.29.6 event ! 3100.2.139.1 0 ! 3100.2.134.11 1 ! 3100.2.106.10 Tariff_Fixed_1x1x1 - v1.0 ! 3100.2.106.1 Tariff_Fixed_1x1x1 ! 3100.2.140.8 1 ! 3100.2.140.7 540 ! 3100.2.142.12 1 ! 3100.2.142.11 540 ! 3100.2.134.13 0 ! 3100.2.124.1 default_balance ! 3100.2.124.9 Money ! 3100.2.124.3 0 ! 3100.2.124.8 0 ! 3100.2.140.4 540 ! 3100.2.124.2 0 ! 3100.2.134.14 0 ! 3100.2.134.13 0 ! 3100.2.124.1 bundle_15GB_Plan ! 3100.2.124.9 Quantity ! 3100.2.140.5 1 ! 3100.2.124.3 10668339 ! 3100.2.124.8 10668340 ! 3100.2.124.2 1 ! 3100.2.124.34 1 ! 3100.2.134.14 0 ! 3100.2.134.12 1 ! 3100.2.134.4 1 ! 3100.2.134.2 1 !
# 6  
Old 06-20-2013
"Connection reset by peer" is a message from TCP in the TCP/IP stack.
It indicates a network problem, for example a misconfigured fire wall.
I don't see why you get this - perhaps because you did not post the whole relevant part of your script.
But I see a possible "Broken pipe" in connection with | head because "head" closes its input stream, sending a SIGPIPE to the feeding process.
This is not serious; you can ignore the "Broken pipe".
In this case you can avoid the pipes by using a one-in-all awk command:
Code:
tkt=/u01/ctrlfile/tkt.tmp
awk '/TICKET NBR/ && ++n==cnt' cnt=$count $cdrFile > $tkt


Last edited by MadeInGermany; 06-20-2013 at 05:28 AM.. Reason: bug fix, not NR
This User Gave Thanks to MadeInGermany For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Can't SSH - Connection reset by Peer

Hi Guys, I can't SSH to a remote system - connection reset by peer..any ideas ? -The Source is Linux, the Remote is Windows -The remote has OpenSSH running on Port 22 - Telnet confirms port is open -User1 has a RSA2 Key (2048) key, which is capture in the 1010101-pub.key specified by the... (1 Reply)
Discussion started by: stevie_velvet
1 Replies

2. UNIX for Dummies Questions & Answers

Sftp - Couldn't read packet: Connection reset by peer

Hello to all, i have a problem when trying to estabilish a sftp connection. i setup a sftp server (i used feeFTPd) and i'm now trying to connect from two different machines. from the first one everything is fine: $ sftp -vvv user@xxx.xxx.xxx.xxx Connecting to xxx.xxx.xxx.xxx...... (9 Replies)
Discussion started by: dc26
9 Replies

3. UNIX for Advanced & Expert Users

Fatal: Read from socket failed: Connection reset by peer [preauth]

Hello, I have recently updated my AIX machine from version 6.1.7.5 to 6.1.9.1 and i noticed that the errpt of the server is full of ssh messages like the one below: sshdprocess_id>]: fatal: Read from socket failed: Connection reset by peer Does anyone knows if this a known bug of the ssh... (15 Replies)
Discussion started by: omonoiatis9
15 Replies

4. UNIX for Dummies Questions & Answers

cat: write error: Connection reset by peer

I have created a script to cat the contents of a log file and pipe it to head and tail so I can get specific lines. When I do this I sometimes randomly get the error "cat: write error: Connection reset by peer". It is completely sporatic and sometimes it doesnt happen and sometimes it does... (4 Replies)
Discussion started by: atelford
4 Replies

5. UNIX for Dummies Questions & Answers

fatal: Read from socket failed: Connection reset by peer

I get this error when I log in through console: "fatal: Read from socket failed: Connection reset by peer". Can you tell me what this is and why it happens, and how to stop it? Thank you. (1 Reply)
Discussion started by: iamnew2solaris
1 Replies

6. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

7. IP Networking

connection reset by peer on freebsd

hi all. am running postgresql in a vm on debian server. i have some client programs connecting to the db. when i check the logs of postgresql i see "connection reset by peer" can someone help me with this issue... thanks. (1 Reply)
Discussion started by: coolatt
1 Replies

8. Shell Programming and Scripting

Connection reset by peer

hi i am connecting to a remote server using sftp protocol. i am using the command like "sftp USER01@122.10.12.45" then i got the error "Couldn't read packet: Connection reset by peer" please help its very urgent (5 Replies)
Discussion started by: Satyak
5 Replies

9. Shell Programming and Scripting

ssh - connection reset by peer

I use ssh to work on the server (OS X 10.4.x) remotely from home (Debian / OS X 10.5.3). If I leave my machine idle, I get disconnected after a couple of minutes. I get the following error message: Read from remote host "server name": Connection reset by peer Connection to "server name" closed.... (2 Replies)
Discussion started by: osxhawk
2 Replies

10. IP Networking

connection reset by peer

:confused: HI, We have 2 servers ( win 2003 + sun 5.8 ) and we run a rsh from the NT to the UNIX. The program runs a shell script on the UNIX and waits for the answer in the EOF. How ever, after period of appx 2 min there is a reply "Recv failed:Connection reset by peer". while the... (5 Replies)
Discussion started by: eyalush
5 Replies
Login or Register to Ask a Question