Grep: writing output: Connection reset by peer

Hi ,

when i run ,

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

i got error

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

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?

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

"Connection reset by peer" is the typical msg if troubles with the network and the connection is lost!

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 !

"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:

tkt=/u01/ctrlfile/tkt.tmp
awk '/TICKET NBR/ && ++n==cnt' cnt=$count $cdrFile > $tkt