Sponsored Content
Full Discussion: sed command help needed.
Top Forums Shell Programming and Scripting sed command help needed. Post 302368653 by pinga123 on Thursday 5th of November 2009 09:15:15 AM
Old 11-05-2009
sed command help needed.

Code:
vif = ['bridge=xenbr0,mac=00:16:3E:64:FB:D3,type=ioemu']

I need to replace "00:16:3E:64:FBSmilie3" to a new mac address value from below mentioned file.
Code:
[root@OVM-SERVER1 vm_temp]# cat vm.cfg
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk = ['file:/var/ovs/mount/93B14928C7A6438284753B2F2AB197BB/seed_pool/vm_temp/System.img,hda,w',
'file:/OVS/iso_pool/winxpsp2/WXPVOL_EN.iso,hdc:cdrom,r',
]
kernel = '/usr/lib/xen/boot/hvmloader'
memory = '300'
name = 'vm_temp'
on_crash = 'restart'
on_reboot = 'restart'
pae = 1
serial = 'pty'
timer_mode = '0'
usbdevice = 'tablet'
uuid = '8569c556-fdf9-41f7-93f4-52350560b13c'
vcpus = 1
vif = ['bridge=xenbr0,mac=00:16:3E:64:FB:D3,type=ioemu']
vif_other_config = []
vnc = 1
vncconsole = 1
vnclisten = '0.0.0.0'
vncpasswd = 'oracle'
vncunused = 1

I have created a variable say Var1 and stored value "mac=00:16:3E:64:FBSmilie3" in that variable.
I have also created a new Variable say Var2 containing new mac address
say Var2=00:16:3E:64:FBSmilie3

Now how do i replace the value "mac=00:16:3E:64:FBSmilie3" to "mac=Var2"

I have created following script but it is not working kindly help
Code:
Number3=`grep -n '^vif =' vm.cfg |awk -F":" '{print $1}'`
echo "vif is found at $Number3"
Variable=`grep -n '^vif =' vm.cfg |awk -F"," '{print $2}'`
echo $Variable

sed "s\$Variable\mac=$NewMacAddress\" vm.cfg

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help needed for sed command

Hi all, I need some help with sed command. I'm trying to move all the files with a modified date within 12:00 - 13:00. What i'm doing here is to do is ls -lt | grep 'Jun 22 12:' > list.txt to get all file names within that period. However how do i strip off -rw-r--r-- 1 enfoot adi... (2 Replies)
Discussion started by: manualvin
2 Replies

2. Shell Programming and Scripting

Help needed in processing multiple variables in a single sed command.

Is it possible to process multiple variables in a single sed command? I have the following ksh with three variables and I want to search for all variables which start with "var" inside input.txt. I tired "$var$" but it just prints out everyting in input.txt and does not work. $ more test.ksh... (5 Replies)
Discussion started by: stevefox
5 Replies

3. Shell Programming and Scripting

sed command explanation needed

Hi, Could you please explain me the below statement -- phrase wise. sed -e :a -e '$q;N;'$cnt',$D;ba' abc.txt > xyz.txt if suppose $cnt contains value: 10 it copies last 9 lines of abc.txt to xyz.txt why it is copying last 9 rather than 10. and also what is ba and $D over there in... (4 Replies)
Discussion started by: subbukns
4 Replies

4. Shell Programming and Scripting

SED command ---------help needed

Hi all I am new babie to shell script, so please advise me n help me . suppose i have a string "abacus sabre", i need to replace occurences 'ab' with 'cd' and i need to store this result into same string and i need to return this result from script to the calling function, where as the string... (4 Replies)
Discussion started by: veerapureddy
4 Replies

5. Shell Programming and Scripting

flexible sed command needed to handle multiple input types

Hello, I need a smart sed command that can take any of the following two as an input and give below mentioned output. As you can see, I am trying to convert some C code INPUT: struct abc_sample1 { char myString; UINT16 myValue1; ... (2 Replies)
Discussion started by: SiftinDotCom
2 Replies

6. Shell Programming and Scripting

Help needed in sed

I have a requirement in my project to create report from a template file. A sample template file is added below: The report data is stored in a file. A sample data file is added below: Using the above template and data file I want to create a report like this: I have tried to... (1 Reply)
Discussion started by: Alecs
1 Replies

7. UNIX for Dummies Questions & Answers

Help needed on sed command

Hi, I am splitting a file based on pattern using sed -f command as below: sed_cmd2 is the Pattern filename which has the below mentioned pattern in it: #n /\(.*\) \(.*\) \(mith\).*/w smith Input file has following data 1 John Smith Chicago 2 Mary Smith New York 3 Judy... (2 Replies)
Discussion started by: 12345
2 Replies

8. Shell Programming and Scripting

Help needed sed command.

I want to execute below command using line number as a variable. sed '5c\ disk = jskdjfdsk' vm.cfg How do i substitute a variable in place of 5 for example i tried substituting sed '$variablec\ disk = jskdjfdsk' vm.cfg and sed '"$variable"c\ disk = jskdjfdsk' vm.cfg) but they... (2 Replies)
Discussion started by: pinga123
2 Replies

9. Shell Programming and Scripting

Help needed - ksh: sed: command garbled:

Hi all, What am I doing wrong here? $ cat test_sed.ksh #!/usr/bin/ksh var="sed -e \'6s/9/6/\' testfile.txt > testfile.txt.2" $var $ ./test_sed.ksh sed: command garbled: \'6s/9/6/\' Thank you! (4 Replies)
Discussion started by: ejianu
4 Replies

10. Shell Programming and Scripting

Help needed with file output awk sed command - please

Hi I have a file that contains lines starting with a particular string plus a Colon: I need to output all these lines but only what comes after the colon Can you pelase assist? Example of lines in the file: com.ubs.f35.cashequities/cashequities: 1 2 ... (5 Replies)
Discussion started by: mnassiri
5 Replies
XENNET(4)						 BSD/xen Kernel Interfaces Manual						 XENNET(4)

NAME
xennet -- Xen frontend paravirtualized network interface SYNOPSIS
xennet* at xenbus? DESCRIPTION
The xennet interface forms the frontend part of the paravirtualized drivers used by Xen guest domains to have network connectivity. When the host domain is NetBSD, the endpoint of the xennet interface is a xvif(4) interface. In the XenStore, xvif and xennet are identified by ``vif'' (virtual interface) entries. Conceptually, frontends and backends drivers are similar to two Ethernet cards connected via a crossover cable. DIAGNOSTICS
xennet%d: can't read mac address, err %d The MAC address for this interface could not be read from XenStore. xennet%d: %s is not a valid mac address The MAC address specified in the configuration file of the newly created guest domain is invalid. xennet%d: using event channel %d The Xen event channel (virtual interrupt) ID associated to this xennet. xennet%d: using RX copy mode The xennet and its associated endpoint use copy mode for communication: packets are copied from one domain's memory to another. xennet%d: using RX flip mode The xennet and its associated endpoint use flip mode for communication: packets are passed by remapping memory pages between domains. SEE ALSO
ifmedia(4), xenbus(4), xvif(4), ifconfig(8) HISTORY
The xennet driver first appeared in NetBSD 3.0. AUTHORS
The xennet driver was written by Manuel Bouyer <bouyer@NetBSD.org> and Christian Limpach <chris@pin.lu>. BSD
January 8, 2011 BSD
All times are GMT -4. The time now is 11:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy