Sponsored Content
Top Forums Shell Programming and Scripting Search comppare replace (substr/lppad) Post 302973082 by Corona688 on Friday 13th of May 2016 06:56:29 PM
Old 05-13-2016
Code:
$ cat data
AT    1      000000000100000000000
BE    4      000000000000030000000
DE    55      000004000000000000000
FR    0      000000000000000110000
CZ    3      000330000000050000000

$ awk '{ printf("%-6s%04d      %s\n", $1,$2,$3); }' < data
AT    0001      000000000100000000000
BE    0004      000000000000030000000
DE    0055      000004000000000000000
FR    0000      000000000000000110000
CZ    0003      000330000000050000000

$

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

2. Shell Programming and Scripting

Search and replace

Hi All, Suppose I have a file "a.doc" It's contents are : mos44.0 ) ..... ...... ..... export TKTS_RELEASE=tkts44.0b7 ...... ....... Now , I need to first search for the pattern "mos44.0 )" and then TKTS_RELEASE will... (8 Replies)
Discussion started by: sanyerra
8 Replies

3. Shell Programming and Scripting

awk - replace number of string length from search and replace for a serialized array

Hello, I really would appreciate some help with a bash script for some string manipulation on an SQL dump: I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump. This is quite easy with sed: sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies

4. Shell Programming and Scripting

perl search and replace - search in first line and replance in 2nd line

Dear All, i want to search particular string and want to replance next line value. following is the test file. search string is tmp,??? ,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50 tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies

5. Shell Programming and Scripting

AWK Substr - find and replace question...

Hello Experts, I have a input file that I need to replace a value only if the file contains the number 6 in column 1. I would like to use AWK in a shell script (ksh on a AIX platform). I need all rows written out, but only change 2 fields when the first column contains a numer 6. Input... (2 Replies)
Discussion started by: scottb
2 Replies

6. UNIX for Dummies Questions & Answers

Help with search and replace or search only of / in vi

Hi all, I am editing a config file in vi that has a / on it. At the moment, search and replace looks alright as am able to use a # as a temporary separator, i.e. :,$s#/u01/app#/u02/app#g For doing a search, I have to escape the / do. So if I want to search for /u01/app, I am having to do... (2 Replies)
Discussion started by: newbie_01
2 Replies

7. Shell Programming and Scripting

search and replace.

Hi, I have a file which contains data in this form. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */;... (2 Replies)
Discussion started by: arijitsaha
2 Replies

8. Shell Programming and Scripting

Search for a substr with nawk

Hi, I have files, with fixed length fields/let's say every field 5 positions/, like this: xxxx 140 xxxxx xxxx 140 xxxxx xxxx 1400 xxxxx xxxx 150 xxxxx I need to get only the records, which have 140 in the second column. I use that command: nawk '{if (substr($0,6,3)=="140") print $0}'... (3 Replies)
Discussion started by: apenkov
3 Replies

9. Shell Programming and Scripting

Nested search in a file and replace the inner search

Hi Team, I am new to unix, please help me in this. I have a file named properties. The content of the file is : ##Mobile props east.url=https://qa.east.corp.com/prop/end west.url=https://qa.west.corp.com/prop/end south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies

10. Shell Programming and Scripting

awk to comppare two files using rwo fields

I use the two awk scripts for comparing file1 and file2. First awk compare $3 column: awk -v OFS="\t" 'NR==FNR{a=$4;next}{$2=$2 "\t"(a?a:"-")}1' file1 file2Second awk compare $2 column: awk -v OFS="\t" 'NR==FNR{a=$4;next}{$2=$2 "\t"(a?a:"-")}1' file1 file2 The only difference ... (12 Replies)
Discussion started by: cmccabe
12 Replies
EFIBOOTMGR(8)															     EFIBOOTMGR(8)

NAME
efibootmgr - manipulate the EFI Boot Manager SYNOPSIS
efibootmgr [ -a ] [ -A ] [ -b XXXX ] [ -B XXXX ] [ -c ] [ -d DISK ] [ -e 1|3|-1 ] [ -E NUM ] [ -g ] [ -H XXXX ] [ -i NAME ] [ -l NAME ] [ -L LABEL ] [ -n XXXX ] [ -N ] [ -o XXXX,YYYY,ZZZZ ... ] [ -O ] [ -p PART ] [ -q ] [ -t seconds ] [ -T ] [ -u ] [ -U XXXX ] [ -v ] [ -V ] [ -w ] [ -@ file ] DESCRIPTION
efibootmgr is a userspace application used to modify the Intel Extensible Firmware Interface (EFI) Boot Manager. This application can cre- ate and destroy boot entries, change the boot order, change the next running boot option, and more. Details on the EFI Boot Manager are available from the EFI Specification, v1.02 or later, available from: <URL:http://developer.intel.com> Note: efibootmgr requires that the kernel support access to EFI non-volatile variables (through /proc/efi/vars on 2.4 kernels, /sys/firmware/efi/vars on 2.6 kernels). modprobe efivars should do the trick. OPTIONS
The following is a list of options accepted by efibootmgr: -a | --active Sets bootnum active -A | --inactive Sets bootnum inactive -b | --bootnum XXXX Modify BootXXXX (hex) -B | --delete-bootnum Delete bootnum (hex) -c | --create Create new variable bootnum and add to bootorder -d | --disk DISK The disk containing the loader (defaults to /dev/sda) -e | --edd 1|3|-1 Force EDD 1.0 or 3.0 creation variables, or guess. -E | --device NUM EDD 1.0 device number (defaults to 0x80) -g | --gpt Force disk with invalid PMBR to be treated as GPT -H | --acpi_hid XXXX set the ACPI HID (used with -i) -i | --iface NAME create a netboot entry for the named interface -l | --loader NAME Specify a loader (defaults to \elilo.efi) -L | --label LABEL Boot manager display label (defaults to "Linux") -n | --bootnext XXXX Set BootNext to XXXX (hex) -N | --delete-bootnext Delete BootNext -o | --bootorder XXXX,YYYY,ZZZZ Explicitly set BootOrder (hex) -O | --delete-bootorder Delete BootOrder -p | --part PART Partition number containing the bootloader (defaults to 1) -q | --quiet Quiet mode - supresses output. --test filename Don't write to NVRAM, write to filename. -t | --timeout seconds Boot Manager timeout, in seconds. -T | --delete-timeout Delete Timeout variable. -u | --unicode | --UCS-2 pass extra command line arguments as UCS-2 (default is ASCII) -U | --acpi_uid XXXX set the ACPI UID (used with -i) -v | --verbose Verbose mode - prints additional information -V | --version Just print version string and exit. -w | --write-signature write unique signature to the MBR if needed -@ | --append-binary-args append extra variable args from file (use - to read from stdin). Data in file is appended as command line arguments to the boot loader command, with no modification to the data, so you can pass any binary or text data necessary. EXAMPLES
1. DISPLAYING THE CURRENT SETTINGS (MUST BE ROOT). [root@localhost ~]# efibootmgr BootCurrent: 0004 BootNext: 0003 BootOrder: 0004,0000,0001,0002,0003 Timeout: 30 seconds Boot0000* Diskette Drive(device:0) Boot0001* CD-ROM Drive(device:FF) Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233) Boot0003* PXE Boot: MAC(00D0B7C15D91) Boot0004* Linux This shows: o BootCurrent - the boot entry used to start the currently running system o BootOrder - the boot order as would appear in the boot manager. The boot manager tries to boot the first active entry in this list. If unsuccessful, it tries the next entry, and so on. o BootNext - the boot entry which is scheduled to be run on next boot. This supercedes BootOrder for one boot only, and is deleted by the boot manager after first use. This allows you to change the next boot behavior without changing BootOrder. o Timeout - the time in seconds between when the boot manager appears on the screen until when it automatically chooses the startup value from BootNext or BootOrder. o Five boot entries (0000 - 0004), along with the active/inactive flag (* means active) and the name displayed on the screen. 2. CREATING A NEW BOOT OPTION An OS installer would call efibootmgr -c. This assumes that /boot/efi is your EFI System Partition, and is mounted at /dev/sda1. This creates a new boot option, called "Linux", and puts it at the top of the boot order list. Options may be passed to modify the default behavior. The default OS Loader is elilo.efi. 3. CHANGING THE BOOT ORDER Assuming the configuration in Example #1, efibootmgr -o 3,4 could be called to specify PXE boot first, then Linux boot. 4. CHANGING THE BOOT ORDER FOR THE NEXT BOOT ONLY Assuming the configuration in Example #1, efibootmgr -n 4 could be called to specify that the Linux entry be taken on next boot. 5. DELETING A BOOT OPTION Assuming the configuration in Example #1, efibootmgr -b 4 -B could be called to delete entry 4 and remove it from the BootOrder. 6. CREATING NETWORK BOOT ENTRIES A system administrator wants to create a boot option to network boot (PXE). Unfortunately, this requires knowing a little more information about your system than can be easily found by efibootmgr, so you've got to pass additional information - the ACPI HID and UID values. These can generally be found by using the EFI Boot Manager (in the EFI environment) to create a network boot entry, then using efibootmgr to print it verbosely. Here's one example: Boot003* Acpi(PNP0A03,0)/PCI(5|0)/Mac(00D0B7F9F510) ACPI(a0341d0,0)PCI(0,5)MAC(00d0b7f9f510,0) In this case, the ACPI HID is "0A0341d0" and the UID is "0". For the zx2000 gigE, the HID is "222F" and the UID is "500". For the rx2000 gigE, the HID is "0002" and the UID is "100". You create the boot entry with: efibootmgr -c -i eth0 -H 222F -U 500 -L netboot BUGS
Please direct any bugs, features, patches, etc. to Matt Domsch <Matt_Domsch@dell.com>. AUTHOR
This man page was generated by dann frazier <dannf@debian.org> for the Debian GNU/Linux operating system, but may be used by others. SEE ALSO
elilo(1) 11 August 2005 EFIBOOTMGR(8)
All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy