Little bit of a help or just a tip


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Little bit of a help or just a tip
# 1  
Old 05-21-2007
Little bit of a help or just a tip

I am about to do a script that change the COST so i dont need to change each cost.
The output looks like this.
Code:
"OL_ID       OL_LINK_COST

----------- ------------

         51           10

         52           10

         53           10

         54           10

         55           10

         56           10

         57           10

         58           10

         59           10

So for each OL_ID i want to change OL_LINK_COST to whatever.
So for each line i want to change that line to something.
Dont need any perfect answers just a bit a tip.

Thank you!

Last edited by Perderabo; 05-21-2007 at 06:43 PM.. Reason: Add code tags for readability
# 2  
Old 05-21-2007
just example:
Code:
awk '$2 == 10{$2=20;}{print}' file

for every second field with value 10, change to 20. then print line and every other line.
# 3  
Old 05-21-2007
Maskot,
See if this will do for you:
Code:
sed 's/ .*/ whatever/' input_file

# 4  
Old 05-21-2007
Sweet

Thank you for the answers!

Didnt had much time when i wrote the thread ill try to explain a bit further.

First of all COST doesnt have to be 10, it can change.
Second it isnt actually the 3rd letter it is like the 23/24 letter which is the COST value.

When i did the copy/paste phase it just happend to get to there.
It actually looks more like this:
space, space, space, space, space 51 space, space, space, space, space, space, space, space and on. 10

i will do a variable which is like cost=30
then
let $cost + COST_LINK
So each COST_LINK will be change in the loop. But the hard part for me is to actually change it.

Not at work atm, will try your kind replys tomorrow

Thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies

2. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

3. UNIX for Advanced & Expert Users

migrating unix mp-ras 32 bit to linux suse 64 bit

Hi. I need to migrate the whole unix environment from a Unix mp-ras 32 bit to a Linux Suse 64 bit. 1) can i use cpio to copy the data? 2) can i just copy the users from unix to linux or do i have to create them by hand 3) are there any other concerns i should worry about? thanx (1 Reply)
Discussion started by: mrodrig
1 Replies

4. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies
Login or Register to Ask a Question