Sponsored Content
Top Forums Shell Programming and Scripting unable to use new line in sed search pattern. Post 302442790 by success on Thursday 5th of August 2010 12:40:49 PM
Old 08-05-2010
unable to use new line in sed search pattern.

hi ,
my lilo.conf is as shown below :
Code:
prompt
    default=Primary
    read-only

image=/boot/bzImage
    label=Primary
    root=/dev/md0
    append="reboot=t md=0 ip=off panic=5 quiet console=ttyS0,115200n81"
    read-only

image=/boot/bzImage
    label=Recover
    root=/dev/sda3
    append="reboot=t ep=off panic=5 quiet console=ttyS0,115200n81"

image=/boot/bzImage
    label=SecRoot
    root=/dev/sda2
    append="reboot=t ip=off panic=5 quiet console=ttyS0,115200n81"

i am writing a tool which takes as input Primary/SecRoot/Recover, based on which i should replace the line "image=/boot/bzImage".

For example if i give SecRoot as input then

image=/boot/bzImage
label=SecRoot

should get replaced by

image=/secroot/boot/bzImage
label=SecRoot

I tried many options of sed, but could not correctly implement it. any help is greatly appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED Search Pattern and Replace with the Pattern

Hello All, I have a string "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031", and I just want to extract LLSV1, but I dont get the expected result when using the sed command below. # echo "CP_STATUS OSSRC_R6_0_Shipment_R1H_CU AOM_901046 R1H_LLSV1_2008031" | awk '{print... (4 Replies)
Discussion started by: racbern
4 Replies

2. UNIX for Dummies Questions & Answers

modify a particular pattern starting from second line of the search pattern

Hi, I am new to this forum and i would like to get help in this issue. I have a file 1.txt as shown: apple banana orange apple grapes banana orange grapes orange .... Now i would like to search for pattern say apple or orange and then put a # at the beginning of the pattern... (2 Replies)
Discussion started by: imas
2 Replies

3. UNIX for Dummies Questions & Answers

modify a particular pattern starting from second line of the search pattern

Hi, I think you ppl did not get my question correctly, let me explain I have 1.txt with following entries as shown: 0152364|134444|10.20.30.40|015236433 0233654|122555|10.20.30.50|023365433 ** ** ** In file 2.txt I have the following entries as shown: ... (1 Reply)
Discussion started by: imas
1 Replies

4. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

5. Shell Programming and Scripting

SED Question: Search and Replace start of line to matching pattern

Hi guys, got a problem here with sed on the command line. If i have a string as below: online xx:wer:xcv: sdf:/asdf/http:https-asdfd How can i match the pattern "http:" and replace the start of the string to the pattern with null? I tried the following but it doesn't work: ... (3 Replies)
Discussion started by: DrivesMeCrazy
3 Replies

6. Shell Programming and Scripting

How to search pattern and add that pattern in next line

Hi All, I am new to shell scripting and need help in scripting using CSH. Here is what I am trying to so, 1. Search a specific string e.g. "task" from "task (input1, out1)". 2. Extract the arguements "input1" and "out1" 3. Add them in separate lines below. eg. "int input1" , " integer out1" ... (7 Replies)
Discussion started by: deshiashish
7 Replies

7. Homework & Coursework Questions

sed Multiple Pattern search and delete the line

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have file which has got the following content sam 123 LD 41 sam 234 kp sam LD 41 kam pu sam LD 61 Now... (1 Reply)
Discussion started by: muchyog
1 Replies

8. Shell Programming and Scripting

How to use sed to search a particular pattern in a file backward after a pattern is matched.?

Hi, I have two files file1.txt and file2.txt. Please see the attachments. In file2.txt (which actually is a diff output between two versions of file1.txt.), I extract the pattern corresponding to 1172c1172. Now ,In file1.txt I have to search for this pattern 1172c1172 and if found, I have to... (9 Replies)
Discussion started by: saurabh kumar
9 Replies

9. Shell Programming and Scripting

Search a pattern in a line and remove another pattern

Hi, I want to search a pattern in a text file and remove another pattern in that file. my text file look like this 0.000000 1.970000 F 303 - 1.970000 2.080000 VH VH + 2.080000 2.250000 VH VH + 2.250000 2.330000 VH L - 2.330000 2.360000 F H + 2.360000 2.410000 L VL - 2.410000 ... (6 Replies)
Discussion started by: sreejithalokkan
6 Replies

10. Shell Programming and Scripting

Sed: printing lines AFTER pattern matching EXCLUDING the line containing the pattern

'Hi I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match. Which option is to be used to exclude the line containing the pattern? sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
kexec(8)							   User Manuals 							  kexec(8)

NAME
kexec - directly boot into a new kernel SYNOPSIS
/sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr] DESCRIPTION
kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. kexec performs the func- tion of the boot loader from within the kernel. The primary difference between a standard system boot and a kexec boot is that the hardware initialization normally performed by the BIOS or firmware (depending on architecture) is not performed during a kexec boot. This has the effect of reducing the time required for a reboot. Make sure you have selected CONFIG_KEXEC=y when configuring the kernel. The CONFIG_KEXEC option enables the kexec system call. USAGE
Using kexec consists of (1) loading the kernel to be rebooted to into memory, and (2) actually rebooting to the pre-loaded kernel. To load a kernel, the syntax is as follows: kexec -l kernel-image --append=command-line-options --initrd=initrd-image where kernel-image is the kernel file that you intend to reboot to. Insert the command-line parameters that must be passed to the new kernel into command-line-options. Passing the exact contents of /proc/cmdline into command-line-options is the safest way to ensure that correct values are passed to the rebooting kernel. The optional initrd-image is the initrd image to be used during boot. It's also possible to invoke kexec without an option parameter. In that case, kexec loads the specified kernel and then invokes shut- down(8). If the shutdown scripts of your Linux distribution support kexec-based rebooting, they then call kexec -e just before actually rebooting the machine. That way, the machine does a clean shutdown including all shutdown scripts. EXAMPLE
For example, if the kernel image you want to reboot to is /boot/vmlinux, the contents of /proc/cmdline is root=/dev/hda1, and the path to the initrd is /boot/initrd, then you would use the following command to load the kernel: kexec -l /boot/vmlinux --append=root=/dev/hda1 --initrd=/boot/initrd After this kernel is loaded, it can be booted to at any time using the command: kexec -e OPTIONS
-e (--exec) Run the currently loaded kernel. Note that it will reboot into the loaded kernel without calling shutdown(8). -f (--force) Force an immediate kexec call, do not call shutdown(8) (contrary to the default action without any option parameter). This option performs the same actions like executing -l and -e in one call. -h (--help) Open a help file for kexec. -l (--load) kernel Load the specified kernel into the current kernel. -p (--load-panic) Load the new kernel for use on panic. -t (--type=type) Specify that the new kernel is of this type. -u (--unload) Unload the current kexec target kernel. If a capture kernel is being unloaded then specify -p with -u. -v (--version) Return the version number of the installed utility. -x (--no-ifdown) Shut down the running kernel, but restore the interface on reload. (If this option is used, it must be specified last.) --mem-min=addr Specify the lowest memory address addr to load code into. --mem-max=addr Specify the highest memory address addr to load code into. SUPPORTED KERNEL FILE TYPES AND OPTIONS
Beoboot-x86 --args-elf Pass ELF boot notes. --args-linux Pass Linux kernel style options. -d (--debug) Enable debugging messages. --real-mode Use the kernel's real mode entry point. elf-x86 --append=string Append string to the kernel command line. --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automati- cally. The BOOT_IMAGE parameter is also stripped. --initrd=file Use file as the kernel's initial ramdisk. --ramdisk=file Use file as the kernel's initial ramdisk. bzImage-x86 --append=string Append string to the kernel command line. --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automati- cally. The BOOT_IMAGE parameter is also stripped. --initrd=file Use file as the kernel's initial ramdisk. --ramdisk=file Use file as the kernel's initial ramdisk. --real-mode Use real-mode entry point. multiboot-x86 --command-line=string Set the kernel command line to string. --reuse-cmdline Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automati- cally. The BOOT_IMAGE parameter is also stripped. --module=mod arg1 arg2 ... Load module mod with command-line arguments arg1 arg2 ... This parameter can be specified multiple times. ARCHITECTURE OPTIONS
--console-serial Enable the serial console. --console-vga Enable the VGA console. --elf32-core-headers Prepare core headers in ELF32 format. --elf64-core-headers Prepare core headers in ELF64 format. --reset-vga Attempt to reset a standard VGA device. --serial=port Specify the serial port for debug output. --serial-baud=baud_rate Specify the baud rate of the serial port. Linux April 2006 kexec(8)
All times are GMT -4. The time now is 06:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy