Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regular expression

Status
Not open for further replies.

stevof

Technical User
Jun 22, 2003
31
CZ
hi, i've got a file which consists of

<number1><number2>string
<number3><number4>string
.
.
.


how can i create a new file where both of numbers'll be decreased by 500?
<number1-500><number2-500>string
<number3-500><number4-500>string
.
.
.

thanx a lot!
 
Try this
Code:
awk '{ $1 = $1 - 500 ; $2 = $2 - 500 ; print }' file

--
 
Try something like this:
nawk -F'[<>]' '
{print "<"$2-500"><"$4-500">"$5}
' /path/to/file

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top