LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-10-2007, 09:03 AM   #1
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Rep: Reputation: 32
Need help with Bash script


I am a little rusty with my bash skills. I haven't had to do this kind of thing in a little while...
I am trying to parse a text file. It's a log of the capture of some rs-232 communications. The format of the log file is as follows:
Code:
Port opened by process "TEST_PRP.EXE" (PID: 3048)

Request: 05/10/2007 8:36:37 AM.16064

 7C 02 03 00 03 12 00 00 18 DC 7D                  |........Ü}     

Request: 05/10/2007 8:36:39 AM.11364 (+1.9530 seconds)

 7C 02 03 00 03 12 00 00 18 DC 7D                  |........Ü}     

Request: 05/10/2007 8:36:40 AM.67664 (+0.5624 seconds)

 7C 02 03 00 03 12 00 00 18 DC 7D 
...
...
...
Request: 05/10/2007 8:37:12 AM.37664 (+0.2187 seconds)

 7C 02 03 00 03 12 00 F0 F7 C3 7D                  |......ð÷Ã}     

Request: 05/10/2007 8:37:12 AM.61064 (+0.2344 seconds)

 7C 02 03 00 03 12 00 F1 E7 E2 7D                  |......ñçâ}     

Request: 05/10/2007 8:37:13 AM.82964 (+0.2187 seconds)

 7C 02 03 00 03 12 00 00 18 DC 7D                  |........Ü}     

Port closed
I want to just have the hex left behind:
Code:
7C 02 03 00 03 12 00 00 18 DC 7D
7C 02 03 00 03 12 00 00 18 DC 7D
7C 02 03 00 03 12 00 00 18 DC 7D 
...
...
...
7C 02 03 00 03 12 00 F0 F7 C3 7D
7C 02 03 00 03 12 00 F1 E7 E2 7D
7C 02 03 00 03 12 00 00 18 DC 7D
Any help or a nudge in the right direction will be much appreciated.

Chris
 
Old 05-10-2007, 09:12 AM   #2
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
grep [0-9][A-F] file | cut -b 1-32

Last edited by 0.o; 05-10-2007 at 09:16 AM.
 
Old 05-10-2007, 09:19 AM   #3
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
Thanks 0.o.
That was the shove I needed.
I modified it to:
Code:
grep [0-9][A-Z] file | cut -d ' ' -f 2-13
To get rid of the leading space.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl in a bash script quadmore Programming 6 02-21-2011 04:11 AM
[bash] having trouble debugging this bash script. jons Programming 4 02-08-2007 06:51 AM
Bash script hangs upon starting another script in the background masea2 Linux - Software 4 11-13-2006 05:18 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration