Sponsored Content
Top Forums Shell Programming and Scripting How to match the first word and print only that line in UNIX? Post 302893352 by web2moha on Tuesday 18th of March 2014 05:52:33 PM
Old 03-18-2014
Linux How to match the first word and print only that line in UNIX?

Below is the file

Code:
DISK-A    109063.2  49  31  40.79
DISK-B    110058.5  49  44  57.07
DISK-c    4402.4    2   1   2.14

from the file, i want to search for 'DISK-A' and print only that line with the first word matching to DISK-A and the output should skip DISK-A.

Desired Output: (If i'm searching for 'DISK-A')
Code:
109063.2  49  31  40.79

Any suggestions would be greatly appreciated.

Last edited by Scrutinizer; 03-18-2014 at 07:20 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search word in a line and print earlier pattern match

Hi All, I have almost 1000+ files and I want to search specific pattern. Looking forwarded your input. Search for: word1.word2 (Which procedure contain this word, I need procedure name in output. Expected output: procedure test1 procedure test2 procedure test3 procedure test4 ... (7 Replies)
Discussion started by: susau_79
7 Replies

2. Shell Programming and Scripting

Print word 1 in line 1 and word 2 in line 2 if it matches a pattern

i have a file in this pattern MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies

3. Shell Programming and Scripting

Print all the words after a match word

Hi, I want to print all words till the last word after the match of "ERROR" word. For e.g. I'll get an sqlplus error with e.g. 1 $ ./calltest_fn.ksh var test_var:=test_fn1; calltest_fn.ksh file1 file2 file3 ERROR at line 4: ORA-06550: line 4, column 11: PLS-00201: identifier... (5 Replies)
Discussion started by: dips_ag
5 Replies

4. Shell Programming and Scripting

print word after pattern match in two instances

i have a file like below. how can i printout the digits followed by the pattern -bwout and -bwin. say i run the script by entering line number 145 (the fourth line), then the o/p should be like 5000000 1024000 8 test1 -ipprot erp -ppsout 500 -ppsin 500 -bwout 300000 -bwin 300000 -statsdevice... (7 Replies)
Discussion started by: sb245
7 Replies

5. Shell Programming and Scripting

Print Line if next line Match a pattern

Hi All, Does anyone know how to print 1H1A....... in peal script print line ^1H1A....... if next line equal 5R0RECEIPT.... Thank for help:D Cat st.txt 1H1A-IN-11-5410-0009420|1010047766|dsds|1|N|IN|IN|000000|1||N|<<<line match 5R0RECEIPT| 5R0RECEIPT|... (2 Replies)
Discussion started by: kittiwas
2 Replies

6. Shell Programming and Scripting

find a word and print n lines before and after the match

how to find a word and print n lines before and after the match until a blank line is encounterd (14 Replies)
Discussion started by: chidori
14 Replies

7. Shell Programming and Scripting

Print a word after a match

Hi all, I have the below line: 08 03 * * 1-5 XXXXXXXXXXXXX -ENVI LDNFOUAT10 -EXE xxxxxxxx -CONFIG \${xxxxx} -SUBCLASS RESET -START -EXTRAAPPARGS \" -env 38LDNFOUAT10 \" >> /tmp/SRRC_xxxxxxx_start.log.`/usr/bin/date +\%Y\%m\%d` 2>&1 I want to print just one word after the string "-env", in... (7 Replies)
Discussion started by: Cvg
7 Replies

8. Shell Programming and Scripting

Print string after the word match

Hi, I have the logs : cat logsx.txt 744906,{"reportingGroups":,"version":"2.0"} 678874,{"reportingGroups":,"version":"2.0"} 193571,{"reportingGroups":,"version":"2.0"} 811537,{"reportingGroups":,"version":"2.0"} 772024,{"reportingGroups":,"version":"2.0"}... (5 Replies)
Discussion started by: justbow
5 Replies

9. Shell Programming and Scripting

Need to print the next word from the same line based on grep string condtion match.

I need to fetch particular string from log file based on grep condition match. Actual requirement is need to print the next word from the same line based on grep string condtion match. File :Java.lanag.xyz......File copied completed : abc.txt Ouput :abc.txt I have used below... (5 Replies)
Discussion started by: siva83
5 Replies

10. Shell Programming and Scripting

Print next line beside preceding line on column match

Hi, I have some data like below: John 254 Chris 254 Matt 123 Abe 123 Raj 487 Moh 487 How can i print it using awk to have: 254 John,Chris 123 Matt,Abe 487 Raj,Moh Thanks. (4 Replies)
Discussion started by: james2009
4 Replies
BOOTCD2DISK.CONF(5)						   bootcd utils 					       BOOTCD2DISK.CONF(5)

NAME
bootcd2disk.conf - configuration file for bootcd2disk DESCRIPTION
The file bootcd2disk.conf contains configuration option for the bootcd2disk(1) program of the same named package. The file must be located in the configuration directory which is usually /etc/bootcd. Blank lines are ignored and lines with leading # are comments. Values have to be set with name=value You can use a wildcard named DISK<number> to specify partitions instead of e.g. /dev/hda<number>. DISK was replaced by $DISK, which can be set by the same named parameter. FORMAT
ERRLOG=<path> Write all errors to this file. Required. DISK=<device|auto> Specify the disk you want to use for the installation, e.g. /dev/hda for the first IDE drive in the system. If you use "auto", bootcd2disk automatically try to use the first hard disk in the system. Required. SFDISK=<partitions in sfdisk syntax|auto> Configuration options for sfdisk, which creates the partitions for us. If you use "auto", we create default partitions "/", "/boot" and a swap partition. Required. VFAT=<partitions separated by spaces> Configure vfat partitions there, if you need some. Optional. EXT2FS=<partitions separated by spaces|auto> Specify the partitions with ext2 or ext3 (see next parameter) here. This partitions would be created and formated. If you use "auto", the "/" and the "/boot" partition would be created. Required. EXT3FS=<yes|no> Enter "yes" If you want ext3 partitions. If you use "auto", the systems use ext3 partition, if the kernel supports it. Required. SWAP=<partitions separated by spaces|auto> The partitions configured there are created as swap. If you use "auto", one swap partition is been created. Required. MOUNT=<mount <partition> <mountpoint>; ... |auto> Insert here the mount command line to mount your partitions or use "auto". Required. UMOUNT=<umount <mountpoint>; ... |auto> Insert here the mount command line to umount your partitions or use "auto". Required. FSTAB=<entries for the systems fstab |auto> Configure here all partitions you need to mount after target systems startup in the fstab syntax or use "auto". Required. LILO=<entries for the systems lilo.conf |auto> This variable includes the complete configuration file for the lilo bootloader on the target system. Use "auto" for automatically generated file. Only required, if you want LILO. Make sure GRUB and GRUB2 are defined as empty if you want to use LILO. GRUB=<entries for the systems grub/menu.lst |auto> This variable includes the complete configuration file for the grub bootloader on the target system. Use "auto" for automatically generated file. Only required, if you want GRUB. GRUB2=<entries for the systems grub/grub.cfg |auto> This variable includes the complete configuration file for the grub2 bootloader on the target system. Use "auto" for automatically generated file. Only required, if you want GRUB 2. GRUBBOOTDIR=<number of partition which contains grub-dir | 0> This variable defines the partition where the grub bootloader information is stored. You want to use this if you have defined your own partition layout and the grub information is not on the first partition. Remember that grub starts counting partitions at 0. So if you decided that /boot is on partition /dev/sda2 you need to set the parameter to 1. GRUBBOOTDISK=<grub disk> This should be "hd0". Only if your BIOS sees another disk as the first disk you may have to change it. GRUBDEVICEMAP=<auto|no|<value>> GRUBDEVICEMAP="auto" means, bootcd2disk deletes the original device.map, so that it will be auto-created by grub again. This should work also when installing on different hardware with different disks. GRUBDEVICEMAP="no" means bootcd2disk does not change device.map. This should work if a bootcd is installed on the original hardware Everything else will be used as new value for device.map. ELILO=<entries for the systems elilo.conf |auto> Same as LILO but for the elilo bootloader on ia64 systems. Use "auto" for automatically generated file. Only required, if you want ELILO. SSHOSTKEY=<yes|no> If you are using ssh it is helpful to have a unique ssh hostkey for each system installed with bootcd2disk. This will be generated if this option is set to "yes". Required. UDEV_FIXNET=<yes|no> If you are using the udev filesystem and want to install the image on other machines, you need to set this to "yes" because the net- work interfaces are hardwired in /etc/udev/rules.d/z25_persistent-net.rules (etch) or in /etc/udev/rules.d/70-persistent-net.rules (lenny) and we must remove them. Required. IMAGEURL=<url> If bootcd2disk is slow on your system (because of a slow CD/DVD drive or the HP ILO virtual CD interface), you can use a image server to get the bootcdimage from. bootcd2disk use the swap partition of your upcoming system as temporary space and copy the image from the configured image server to this partition and use it as image. May be overwritten from command line "-url". Need the following parameter "IMAGEURL". Required. The <url> is used with wget, all url syntax from wget are possible. Please use a ip because of failed DNS and you need also the con- figured ip interface. May be overwritten from command line (-url). Required. example: IMAGEPURL="https://192.168.1.1:81/cdimage.iso" function before_copy() { return } If you want some action before copying the system to the target disk, like remount or other thinks, you can write this action to the body of this function. Optional. function after_copy() { return } If you want some action after copying the system to the target disk, like remount or other thinks, you can write this action to the body of this function. Optional. SEE ALSO
bootcd2disk(1), bootcd(1), bootcdflopcp(1), bootcdwrite(1) AUTHOR
This manual page was written by Carsten Dinkelmann <carsten.dinkelmann@foobar-cpa.de>, for the Debian GNU/Linux system (but may be used by others). bootcd2disk.conf 2007-04-04 BOOTCD2DISK.CONF(5)
All times are GMT -4. The time now is 07:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy