Sponsored Content
Full Discussion: changing line on a file
Top Forums Shell Programming and Scripting changing line on a file Post 302363130 by iga3725 on Monday 19th of October 2009 01:59:44 PM
Old 10-19-2009
changing line on a file

Hi, I want to change on a file this line:

vif = [ 'ip=167.112.194.243,mac=00:16:3E:CE:23:14' ]

into:

vif = [ 'ip=167.112.194.243,mac=00:16:3E:CE:23:14,vifname=veth216','ip=10.1.1.1,mac=00:16:3E:FD:58:BB,vifnam e=veth216a']

But there are some conditionals:

1. last part '] of the original line after 00:16:3E:CE:23:14' ] may vary to 00:16:3E:CE:23:14' ] or 00:16:3E:CE:23:14 ' ]
2. The second mac adrress of the line I need, 00:16:3E:FD:58:BB, must be different every time I run sed. Maybe just changing the last two characters BB to other two characters.
3. The [ ' and ' ] of both lines could be separated by some espaces, example [ ' or [' or ' ] or '] so you should not take this characters as a reference.
4. The Ip 167.xx.xx.xx and first mac address 00:16:3E:CE:23:14 are the same in two line. The second ip always is 10.1.1.1, and the second mac address must change every time I run sed command. Smilie

thanks tons
regards,
Israel.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing Line Number of a File

Example: O o x What I would like to do is to rename the first column of the above file without affecting the format. The output should look like the following: Output: O o x #! /bin/ksh cd $HOME/lib/.Lee #nl = no. of lines. nl=`grep 'X' ex | wc -l` #ln = line no. ln=1 (17 Replies)
Discussion started by: ilak1008
17 Replies

2. Shell Programming and Scripting

changing colomn to the line

I have a file which has only one colomn of numbers,ex: 122 173 292 400 979 2152 2339 2376 2387 2446 2450 What ksh / unix command should I use to create a file in which those numbers will be in one line,like this 122 173 292 400 979 .... etc Thanks a lot for help (9 Replies)
Discussion started by: aoussenko
9 Replies

3. AIX

Yesterday's date without changing anything and in one cmd line ?

I have seen references in the forum about getting yesterday's date but it is either by changing something in the system (date, time zone, ...) or with more then one line of script cmds. How can I get yesterday's date without changing anything in the system and in one single command line ? (4 Replies)
Discussion started by: Browser_ice
4 Replies

4. Shell Programming and Scripting

changing from command line to perl script

I had posted previously about this problem I had. I have multiple text files with hundreds of lines of the following type: 2000001 34 54 234 2000001 32 545 2000001 -2000001 77 2000001 44 2000001 998 2000001 77 32 2000001 45 23 111 89 98 75 23 34 999 . . . etc... What I wanted was... (2 Replies)
Discussion started by: xchen89x
2 Replies

5. Shell Programming and Scripting

Need help in changing vertical lines to horizontal line in a file

Hi, I have a file like below robert PREF: 3 AVAIL: henry PREF: 234 AVAIL: john PREF: 145,178 AVAIL: 123 matt PREF: 564,932 AVAIL: ten PREF: 389 AVAIL: kill (2 Replies)
Discussion started by: rocky1954
2 Replies

6. Shell Programming and Scripting

Read file line by line and process the line to generate another file

Hi, i have file which contains data as below(Only sample shown, it may contain more data similar to the one shown here) i need to read this file line by line and generate an output file like the one below i.e based on N value the number of MSISDNs will vary, if N=1 then the following... (14 Replies)
Discussion started by: aemunathan
14 Replies

7. Shell Programming and Scripting

Need Help!!! For changing the content of the line

I need to change the content of the line after I grep it. The line is : Date SNWD.I-1 (in) WTEQ.I-1 (in) PREC.I-1 (in) TOBS.I-1 (degC) TMAX.D-1 (degC) TMIN.D-1 (degC) TAVG.D-1 (degC) I want to change the second column (SNWD.I-1(in)) to SNWD.I-1(m), how could I do that? I use csh... (2 Replies)
Discussion started by: handsonzhao
2 Replies

8. Shell Programming and Scripting

Changing Line in Txt File

So I have a python program that I run, which runs accordingly to options I have listed in a text file (ie user_prefs). Now there are many options listed in this user_prefs.txt, but the one of most interest to me is that of the file path of the time series. I have over a hundred of these time... (8 Replies)
Discussion started by: Jimmyd24
8 Replies

9. UNIX for Dummies Questions & Answers

Changing a special line and Byte in a random file

Hello I created 3 files by: dd if=/dev/urandom bs=1024 count=1000000 of=./testfile1 dd if=/dev/urandom bs=1024 count=5000000 of=./testfile2 dd if=/dev/urandom bs=1024 count=10000000 of=./testfile3 Now I want to know how to make a change in a specific byte and/or line of theses files? (2 Replies)
Discussion started by: frhling
2 Replies

10. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies
XVIF(4) 						 BSD/xen Kernel Interfaces Manual						   XVIF(4)

NAME
xvif -- Xen backend paravirtualized network interface SYNOPSIS
pseudo-device xvif DESCRIPTION
The xvif interface forms the backend part of the paravirtualized drivers used by Xen domains to offer network connectivity. When the guest domain is NetBSD, the endpoint of the xvif interface is a xennet(4) interface. In the XenStore, xvif and xennet are identi- fied by ``vif'' (virtual interface) entries. All xvif interfaces follow the ``xvifXiY'' naming convention, where 'X' represents the guest domain identifier, and 'Y' an arbitrary identi- fier; most of the time, it is the frontend interface identifier, e.g. ``xennetY''. For convenience, the MAC address of an xvif interface is chosen by incrementing the third byte of the MAC address of the frontend device. Conceptually, frontends and backends drivers are similar to two Ethernet cards connected via a crossover cable. DIAGNOSTICS
xvif%di%d: can't read %s/mac: %d The MAC address for this interface could not be read from XenStore. xvif%di%d: %s is not a valid mac address The MAC address specified in the configuration file of the newly created guest domain is invalid. xvif%di%d: Ethernet address %s MAC address of the xvif interface. SEE ALSO
ifmedia(4), xennet(4), ifconfig(8) HISTORY
The xvif driver first appeared in NetBSD 4.0. AUTHORS
The xvif driver was written by Manuel Bouyer <bouyer@NetBSD.org>. BSD
April 7, 2011 BSD
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy