Sponsored Content
Top Forums Shell Programming and Scripting sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3 Post 302905344 by Gautham on Wednesday 11th of June 2014 05:17:48 AM
Old 06-11-2014
@Vinay
Have a look into following link:
https://linuxacademy.com/blog/linux/...iff-and-patch/

It uses both diff and patch. Explains you exactly for what you're looking.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a file based on pattern in awk, grep, sed or perl

Hi All, Can someone please help me write a script for the following requirement in awk, grep, sed or perl. Buuuu xxx bbb Kmmmm rrr ssss uuuu Kwwww zzzz ccc Roooowwww eeee Bxxxx jjjj dddd Kuuuu eeeee nnnn Rpppp cccc vvvv cccc Rhhhhhhyyyy tttt Lhhhh rrrrrssssss Bffff mmmm iiiii Ktttt... (5 Replies)
Discussion started by: kumarn
5 Replies

2. Shell Programming and Scripting

Extracting pattern only with AWK | SED | GREP

We have the following statement working in CGYWIN, but when we move the program to Solaris 10 it fails. x=`echo "ABC196925XYZ" | grep -o --only-matching "\{6\}"` How can we use AWK or SED to extract only the number from the string? The following outputs the entire string. We only want... (5 Replies)
Discussion started by: James Clark
5 Replies

3. Shell Programming and Scripting

How to awk/sed/grep lines which contains a pattern at a given position

Dear friends I am new to linux and was trying to split some files userwise in our linux server. I have a data file of 156 continuous columns named ecscr final. I want the script to redirect all the lines containing a pattern of 7 digits to separate files. I was using grep to do that,... (2 Replies)
Discussion started by: anoopvraj
2 Replies

4. Shell Programming and Scripting

Help to search multiple pattern in file with grep/sed/awk

Hello All, I have a file which is having below type of data, Jul 19 2011 | 123456 Jul 19 2011 | 123456 Jul 20 2011 | 123456 Jul 20 2011 | 123456 Here I wanted to grep for date pattern as below, so that it should only grep "Jul 20" OR "Jul ... (9 Replies)
Discussion started by: gr8_usk
9 Replies

5. UNIX for Dummies Questions & Answers

One liner pattern search with awk/sed/grep

I have an array containing bunch of characters. I have to check this array for specific character and if "Not Found than" use a goto statement to go to USAGE set options = (A B C D E F) @ i = 0 while ($i <= ${#options}) if ($options != "F" || $options != "D") then goto USAGE endif @... (1 Reply)
Discussion started by: dixits
1 Replies

6. Shell Programming and Scripting

How to print the lines between the pattern using awk/grep/sed?

Hi, I need a help to search a pattern and print the multiple lines between them. Input file: Tue May 29 12:30:33 EDT 2012:threadWebContainer : 357:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelCancelReservation request: ... (4 Replies)
Discussion started by: aroragaurav.84
4 Replies

7. Shell Programming and Scripting

Sed/awk : to grep only required pattern disk

Hi Experts, Need help with the following: Desired output: Only want to get the output marked in green. The file: --- Physical volumes --- PV Name /dev/disk/disk4704 PV Status available Total PE 6399 Free PE ... (3 Replies)
Discussion started by: rveri
3 Replies

8. UNIX for Dummies Questions & Answers

Grep -v lines starting with pattern 1 and not matching pattern 2

Hi all! Thanks for taking the time to view this! I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern. Example: Drink a soda Eat a banana Eat multiple bananas Drink an apple juice Eat an apple Eat multiple apples I... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

10. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies
Patch(3pm)						User Contributed Perl Documentation						Patch(3pm)

NAME
Text::Patch - Patches text with given patch SYNOPSIS
use Text::Patch; $output = patch( $source, $diff, STYLE => "Unified" ); use Text::Diff; $src = ... $dst = ... $diff = diff( $src, $dst, { STYLE => 'Unified' } ); $out = patch( $src, $diff, { STYLE => 'Unified' } ); print "Patch successful" if $out eq $dst; DESCRIPTION
Text::Patch combines source text with given diff (difference) data. Diff data is produced by Text::Diff module or by the standard diff utility (man diff, see -u option). patch( $source, $diff, options... ) First argument is source (original) text. Second is the diff data. Third argument can be either hash reference with options or all the rest arguments will be considered patch options: $output = patch( $source, $diff, STYLE => "Unified", ... ); $output = patch( $source, $diff, { STYLE => "Unified", ... } ); Options are: STYLE => 'Unified' STYLE can be "Unified", "Context" or "OldStyle". The 'Unified' diff format looks like this: @@ -1,7 +1,6 @@ -The Way that can be told of is not the eternal Way; -The name that can be named is not the eternal name. The Nameless is the origin of Heaven and Earth; -The Named is the mother of all things. +The named is the mother of all things. + Therefore let there always be non-being, so we may see their subtlety, And let there always be being, @@ -9,3 +8,6 @@ The two are the same, But after they are produced, they have different names. +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties! TODO
Interfaces with files, arrays, etc. AUTHOR
Vladi Belperchinov-Shabanski "Cade" <cade@biscom.net> <cade@datamax.bg> <cade@cpan.org> http://cade.datamax.bg VERSION
$Id: Patch.pm,v 1.6 2007/04/07 19:57:41 cade Exp $ perl v5.10.1 2010-10-04 Patch(3pm)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy