Sponsored Content
Top Forums Shell Programming and Scripting Grep starting from a specific position Post 302537394 by Lord Spectre on Friday 8th of July 2011 04:03:07 AM
Old 07-08-2011
Quote:
Originally Posted by michaelrozar17
Can you replace grep (in post# 1) with the below sed and try
Code:
sed '/51/s/.\{24\}\(.*\)/\1\n/'

Nope! This is what I seen on the screen:

Code:
2011-07-08 09:56:07.118713 IP 192.168.1.5.10000 > 192.168.1.5.5000: . ack 938 win 62907
E..( .@.{...
a.Z
a..'....Rl.....P.............
2011-07-08 09:56:12.769254 IP 192.168.1.5.5000 > 192.168.1.5.10000: P 938:1334(396) ack 960 win 63784
E...:.@.@...
a..
a.Z..'......Rl.P..(1E...50/00394/O/53/192.168.1.55000/1234565/////////////2234234324/0/000/080711100001/3//E/////////////EF.
2011-07-08 09:56:12.836946 IP 192.168.1.5.10000 > 192.168.1.5.5000: P 960:982(22) ack 1334 win 64240
E..>!.@.{..L
a.Z
a..'....Rl.... P....(...50/00020/R/53/A///9B.
2011-07-08 09:56:12.876289 IP 192.168.1.5.5000 >192.168.1.5.10000: . ack 982 win 63784
E..(:.@.@..~

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed to replace specific character and specific position

I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done? Example: File: A0199999123 A0199999124 A0199999125 Need to replace 99999 in positions 3-7 with 88888. Any help is appreciated. (5 Replies)
Discussion started by: programmer22
5 Replies

2. Shell Programming and Scripting

How to put a word starting at particular position in a file using shell scripting

Hi all, I'm new to shell scripting and hence this query. I have 2 files. temp.txt and config.txt. The values in temp.txt are tab separated. ex: temp.txt AB CDE GHIJ OPQRS WXY ex:config.txt (1st line for 1st element of temp.txt and so on) start = '1' end='5' start = '6' end =... (26 Replies)
Discussion started by: subhrap.das
26 Replies

3. Shell Programming and Scripting

perform some operation on a specific coulmn starting from a specific line

I have a txt file having rows and coulmns, i want to perform some operation on a specific coulmn starting from a specific line. eg: 50.000000 1 1 1 1000.00000 1000.00000 50000.000 19 19 3.69797533E-07 871.66394 ... (3 Replies)
Discussion started by: shashi792
3 Replies

4. Shell Programming and Scripting

substitute a string on a specific position for specific lines

I woud like to substitue a string on a specific position for specific lines I've got a file and I would like to change a specific string from "TOCHANGE" to "ABCABCAB" For every line (except 1,2, 3 and the last one) , I need to check between the 9th and the 16th digits. For the 3rd line, I... (7 Replies)
Discussion started by: BSF
7 Replies

5. Shell Programming and Scripting

Remove the spaces at the end of a line starting from a fixed position

I want to remove the trailing spaces at the end of each line starting from a particular position(using ksh script). For example, in the attached file, I want to remove all the spaces starting from the position 430 till the end. The space has to be removed only from the 430th position no matter in... (3 Replies)
Discussion started by: Suryaaravindh
3 Replies

6. Shell Programming and Scripting

Find the starting position in a file

I have a file called "INPUT" which takes the following format MNT-BANK-NUMBERO:006,00:N MNT-100-ACCOUNT-NUMBERO:018,00:N MNT-1000-DESCRIPTIONO:045:C . . . Now i got to find the displacements of the account numbers of each field of a file. For the field MNT-BANK-NUMBERO:006,00:N, the... (4 Replies)
Discussion started by: bobby1015
4 Replies

7. Shell Programming and Scripting

Extract specific line in an html file starting and ending with specific pattern to a text file

Hi This is my first post and I'm just a beginner. So please be nice to me. I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file? I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies

8. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

9. Shell Programming and Scripting

Grep a log file starting from a specific time to the end of file

I have a log file which have a date and time at the start of every line. I need to search the log file starting from a specific time to the end of file. For example: Starting point: July 29 2018 21:00:00 End point : end of file My concern is what if the pattern of `July 29 2018 21:00:00`... (3 Replies)
Discussion started by: erin00
3 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
TRAFSHOW(1)						      General Commands Manual						       TRAFSHOW(1)

NAME
trafshow - full screen show network traffic SYNOPSIS
trafshow [-vpnb] [-a len] [-c conf] [-i name] [-s str] [-u port] [-R refresh] [-P purge] [-F file | expr] DESCRIPTION
TrafShow is a simple interactive program that gather the network traffic from all libpcap-capable interfaces to accumulate it in memory cache, and then separately display it on appropriated curses window in line-narrowed manner as a list of network flows sorted by through- put. Display updates occurs nearly in real time, asynchronously from the data collecting. It look like a live show of traffic flows. Any kind of network traffic are mixed together in the one live-show screen, an Ethernet, IP, etc. Hint: Please press `H' key inside a show to get brief help! The IP traffic can be aggregated by netmask prefix bits and service ports to reorganize a heap of trivial flows into the treelike hierar- chies suitable for human perception. The user can glance over the list of resulting flows and select at their to browse detail. So you can deepen into the traffic inheritance hierarchy and inspect the packets of each trivial flow in variety of presentations: raw-hex, ascii, time-stamp. The program make aggregation automatically when number of flows will exceed some reasonable amount. Just a few seconds after launch may be required for adaptation to your volume of traffic. Use -a len option (see below) to overwrite the default behaviour. TrafShow also listens on UDP port (9995 by default) for diverse feeders of Cisco Netflow and then separately display the collected data in the same manner as described above. The following versions of Netflow are currently supported: V1, V5, V7. Use -u port option (see below) to overwrite the default behaviour. This program may be found wonderful at lest to locate suspicious traffic on the net very quickly on demand, or to evaluate real time traf- fic bandwidth utilization, in a simplest and convenient environment. But it is not intended for collecting and analysis of the network traffic for a long period of time, nor for billing! The program pretend to be IPv6 compatible and ready to using, but it is not tested enough. You can define INET6 to do so. OPTIONS
-v Print detailed version information and exit. -p Do not put interface(s) into promiscuous mode. -n Do not convert numeric values to names (host addresses, port numbers, etc.). The mode can be toggled On/Off during a show by press- ing the `N' key. -b To place a backflow entries near to the main streams in the sorted list of traffic flows. Note: this mode can raise the system load dangerously high because it take a lot of CPU cycles! -a len To aggregate traffic flows using IP netmask prefix len. This option also turn on service ports aggregation. The len expected as num- ber of bits in the network portion of IP addresses (like CIDR). The aggragation len can be changed during a show by pressing the `A' key, and turned Off by empty string. Hint: Please use 0 to reduce output just for network services. -c conf Use alternate color config file instead of default /etc/trafshow. -i name Listen on the specified network interface name. If unspecified, TrafShow collect data from all network interfaces, configured UP in the system. In the last case the system must supply enough number of packet capture devices (like /dev/bpf#). -s str To search and follow for list item matched by string, moving the cursor bar. The found item try to stay highlighted. The mode can be turned Off by `Ctrl-/' key press or [re]entered again by `/' key directly in the live show. -u port Listen on the specified UDP port number for the Cisco Netflow feed. The default port number is 9995. Hint: Please use 0 to disable this functionality. -R refresh Set the refresh period of data show to seconds, 2 seconds by default. This option can be changed during a show by pressing the `R' key. -P purge Set the expired data purge period to seconds, 10 seconds by default. This option can be changed during a show by pressing the `P' key. -F file Use file as input for the filter expression. expr Select which packets will be displayed. If no expression is given, all packets on the net will be displayed. Otherwise, only packets for which expression is `true' will be displayed. The filter expression can be changed during a show by pressing the `F' key, and turned Off by empty string. Please see tcpdump(1) man page for syntax of filter expression. FILES
/etc/trafshow The default colors configuration file if any. $HOME/.trafshow The personal file with the user defined colors. COLORS
If TrafShow has been compiled with modern curses libraries such as Slang or Ncurses it been able to show colored traffic on the color-capa- ble terminal. Hopefully, no special actions required to install them because your system has it by default (leastwise last years). The syntax of TrafShow color configuration file as follow: default fcolor:bcolor Set the default screen background color-pair port[/proto] fcolor:bcolor Set color pattern by service port [proto] src[/mask][,port] dst[/mask][,port] fcolor:bcolor Set color pattern by pair of source and destination addresses The tokens *, any, or all matchs ANY in the pattern. Where fcolor is foreground color and bcolor is background color. The fcolor and bcolor may be one of the following: black red green yellow blue magenta cyan white It posible to indicate color as number from 0 to 7. The upper-case Fcolor mean bright on. The upper-case Bcolor mean blink on. SEE ALSO
pcap(3), tcpdump(1), bpf(4) ACKNOWLEDGEMENTS
Thanks to Van Jacobson <van(at)helios.ee.lbl.gov> and Steven McCanne <mccanne(at)helios.ee.lbl.gov>, all of Lawrence Berkeley Laboratory, University of California, Berkeley. Special thank to Jun-ichiro itojun Hagino <itojun(at)iijlab.net> for IPv6 patches. AUTHOR
Vladimir Vorobyev <bob(at)turbo.nsk.su>. BUGS
Depending of traffic volume, TrafShow can take a lot of CPU cycles and memory. It is impossible to use packet matching expressions in the NetFlow mode. May 2004 TRAFSHOW(1)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy