Sponsored Content
Top Forums Shell Programming and Scripting Required 3 lines above the file and below file when string matches Post 302951855 by derekludwig on Tuesday 11th of August 2015 07:36:12 AM
Old 08-11-2015
Check out the -B and -A options of grep.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Displaying lines of a file where the second field matches a pattern

Howdy. I know this is most likely possible using sed or awk or grep, most likely a combination of them together, but how would one go about running a grep like command on a file where you only try to match your pattern to the second field in a line, space delimited? Example: You are... (3 Replies)
Discussion started by: LordJezoX
3 Replies

2. Shell Programming and Scripting

If string matches within 2 files, delete one file.

I have a directory with a large # of files and in each file I am looking to match a string in one file with a string in the subsequent n file(s). If there is a match between a string in one file and a string in the next n file(s) then delete the subsequent duplicate file(s). Here is sample input: ... (2 Replies)
Discussion started by: sitney
2 Replies

3. Shell Programming and Scripting

Merge lines from one file if pattern matches

I have one comma separated file (a.txt) with two or more records all matching except for the last column. I would like to merge all matching lines into one and consolidate the last column, separated by ":". Does anyone know of a way to do this easily? I've searched the forum but most talked... (6 Replies)
Discussion started by: giannicello
6 Replies

4. UNIX for Dummies Questions & Answers

How get only required lines & delete the rest of the lines in file

Hiiii I have a file which contains huge data as a.dat: PDE 1990 1 9 18 51 28.90 24.7500 95.2800 118.0 6.1 0.0 BURMA event name: 010990D time shift: 7.3000 half duration: 5.0000 latitude: 24.4200 longitude: 94.9500 depth: 129.6000 Mrr: ... (7 Replies)
Discussion started by: reva
7 Replies

5. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

6. Shell Programming and Scripting

String replacement when particular pattern matches in a file

I have a file file123.xml which looks like this xmlEntry="username"="josh" <property="never_back_down"> phone="<178652>" apn=property:address="wonderland" xmlEntry="username"="jessica" <property="never_back_down"> phone="<178653>" apn=property:address="wonderland"... (5 Replies)
Discussion started by: poga
5 Replies

7. Shell Programming and Scripting

regex matches from lines in file

Hello, I try to script something (bash-script) and can not find a way to get and store a match into a variable from a line in a file. grep isn't useful as the matches are not returned - just colored. I can't get 'expr' to work for me. Is it necessary to use a perl-script with regex instead? ... (7 Replies)
Discussion started by: daWonderer
7 Replies

8. Shell Programming and Scripting

Help in printing n number of lines if a search string matches in a file

Hi I have below script which is used to grep specific errors and if error string matches send an email alert. Script is working fine , however , i wish to print next 10 lines of the string match to get the details of error in the email alert Current code:- #!/bin/bash tail -Fn0 --retry... (2 Replies)
Discussion started by: neha0785
2 Replies

9. Shell Programming and Scripting

Exclude lines in a file with matches with multiple Strings using egrep

Hi I have a txt file and I would like to use egrep without using -v option to exclude the lines which matches with multiple Strings. Let's say I have some text in the txt file. The command should not fetch lines if they have strings something like CAT MAT DAT The command should fetch me... (4 Replies)
Discussion started by: Sathwik
4 Replies

10. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies
GRUB-FILE(1)						      General Commands Manual						      GRUB-FILE(1)

NAME
grub-file -- Check if FILE is of specified type. SYNOPSIS
grub-file (--is-i386-xen-pae-domu | --is-x86_64-xen-domu | --is-x86-xen-dom0 | --is-x86-multiboot | --is-x86-multiboot2 | --is-arm-linux | --is-arm64-linux | --is-ia64-linux | --is-mips-linux | --is-mipsel-linux | --is-sparc64-linux | --is-powerpc-linux | --is-x86-linux | --is-x86-linux32 | --is-x86-kfreebsd | --is-i386-kfreebsd | --is-x86_64-kfreebsd | --is-x86-knetbsd | --is-i386-knetbsd | --is-x86_64-knetbsd | --is-i386-efi | --is-x86_64-efi | --is-ia64-efi | --is-arm64-efi | --is-arm-efi | --is-hibernated-hiberfil | --is-x86_64-xnu | --is-i386-xnu | --is-xnu-hibr | --is-x86-bios-bootsector) FILE DESCRIPTION
grub-file is used to check if FILE is of a specified type. OPTIONS
--is-i386-xen-pae-domu Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel --is-x86_64-xen-domu Check if FILE can be booted as x86_64 Xen unprivileged guest kernel --is-x86-xen-dom0 Check if FILE can be used as Xen x86 privileged guest kernel --is-x86-multiboot Check if FILE can be used as x86 multiboot kernel --is-x86-multiboot2 Check if FILE can be used as x86 multiboot2 kernel --is-arm-linux Check if FILE is ARM Linux --is-arm64-linux Check if FILE is ARM64 Linux --is-ia64-linux Check if FILE is IA64 Linux --is-mips-linux Check if FILE is MIPS Linux --is-mipsel-linux Check if FILE is MIPSEL Linux --is-sparc64-linux Check if FILE is SPARC64 Linux --is-powerpc-linux Check if FILE is POWERPC Linux --is-x86-linux Check if FILE is x86 Linux --is-x86-linux32 Check if FILE is x86 Linux supporting 32-bit protocol --is-x86-kfreebsd Check if FILE is x86 kFreeBSD --is-i386-kfreebsd Check if FILE is i386 kFreeBSD --is-x86_64-kfreebsd Check if FILE is x86_64 kFreeBSD --is-x86-knetbsd Check if FILE is x86 kNetBSD --is-i386-knetbsd Check if FILE is i386 kNetBSD --is-x86_64-knetbsd Check if FILE is x86_64 kNetBSD --is-i386-efi Check if FILE is i386 EFI file --is-x86_64-efi Check if FILE is x86_64 EFI file --is-ia64-efi Check if FILE is IA64 EFI file --is-arm64-efi Check if FILE is ARM64 EFI file --is-arm-efi Check if FILE is ARM EFI file --is-hibernated-hiberfil Check if FILE is hiberfil.sys in hibernated state --is-x86_64-xnu Check if FILE is x86_64 XNU (Mac OS X kernel) --is-i386-xnu Check if FILE is i386 XNU (Mac OS X kernel) --is-xnu-hibr Check if FILE is XNU (Mac OS X kernel) hibernated image --is-x86-bios-bootsector Check if FILE is BIOS bootsector SEE ALSO
info grub Web Feb 26 2014 GRUB-FILE(1)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy