LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   sed: how to change MAC address string with sed (https://www.linuxquestions.org/questions/linux-software-2/sed-how-to-change-mac-address-string-with-sed-823028/)

cold 07-30-2010 07:37 AM

sed: how to change MAC address string with sed
 
Hello *,
please I need to know how can I change the MAX address string using sed. What I need is to add or subtract number from MAC address, e.g.

Input string:
ethaddr=00:21:04:4D:BB:00

Output string
ethaddr=00:21:04:4D:BB:05

Sorry for bugging but I don't have enough time to study the solution by myself and I'm not experienced with sed :-(.

Many thanks in advance.
jn.

pixellany 07-30-2010 08:31 AM

Quote:

I don't have enough time to study the solution by myself and I'm not experienced with sed
....and, by implication, you also don't have time to learn SED?
This is not a good way to get help here....

First, you don't say what the criteria is for making a change. For example, is it always the last portion that needs to be changed? Do we need to test and sure the target number is part of a MAC? ....etc.

Second, why SED? If you set the the field separator to ":", then AWK is very handy for discriminating columns.

devnull10 07-30-2010 10:52 AM

Quote:

I don't have enough time to study the solution by myself and I'm not experienced with sed
And I don't have enough time to help you either.

RockDoctor 07-30-2010 03:31 PM

I have the time, and I know enough about awk (but not sed) to be able to accomplish the task, but I don't have enough time to post the solution

cold 08-02-2010 03:22 AM

Guys,
I didn't have time to learn SED (no AWK on board) since I had some tight deadlines when this task had to be finished. Please if you don't want to help, don't start flames here.

pixellany 08-02-2010 07:43 AM

Sorry, cold, but you started it.

If you read the thread, you'll see that I did want to help----I asked you a question which you apparently did not have time to answer. (My post was less than an hour after your started the thread.)

Quote:

I had some tight deadlines when this task had to be finished.
Why is this our problem?


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