Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to pull data out of a file to execute a series of repetitive commands. One of the fields is a {hex number}.{hex number} pattern. I need the first part of that structure to pass into the command. The file structure is like this:
A 2007/10/20 09:50:00 li text ef6da.1 name 8888.1 99999 path
A 2007/10/20 09:55:00 li text fa57.2a4b8 name 7777.1 99998 pathWhat i need to do is output a command line for each entry like:
request -p ef6da -m li -v 99999 path
request -p fa57 -m li -v 99998 pathWhat I am having problems with is splitting the first part of the 6th field, I need the portion prior to the period and not the part after. My attempt has stymied at:
cat filename | awk '{printf "request -p %s -m li -v %s path", $6, $9}' > outfile
I have been trying to modify the field within this format and can't get it to work. MY BRAIN IS FRIED
ANY help would be appreciated. Running on solaris 9 so I have awk, sed, & perl available.

Hmm, try this:
cat filename | awk '{printf "request -p %s -m li -v %s path\n", $6, $9}'|sed -e "s/\..* -m/ -m/g"Im basically just using sed to strip off the .XXXX

That worked perfectly thanks (i missed a space before the second -m at first). I really appreciate your help.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |