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 302905349 by breezevinay on Wednesday 11th of June 2014 05:52:51 AM
Old 06-11-2014
Actually i wont be having modified file , i having shown the diff to explain my requirement . Actually we will be having only original file which gets generated while compiling a make file , so in the make file at the time of generation i wanted to introduce all the modification rather the differences which which i have shown . So to meet this requirement , i need to modify the original file only . So for modification i may need sed and awk , if there is any other way also it is fine.
 

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
DIFFSTAT(1)						      General Commands Manual						       DIFFSTAT(1)

NAME
diffstat - make histogram from diff-output SYNOPSIS
diffstat [options] [file-specifications] DESCRIPTION
This program reads the output of diff and displays a histogram of the insertions, deletions, and modifications per-file. Diffstat is a program that is useful for reviewing large, complex patch files. It reads from one or more input files which contain output from diff, producing a histogram of the total lines changed for each file referenced. If the input filename ends with .bz2, .gz, .lzma, .z or .Z, diffstat will read the uncompressed data via a pipe from the corresponding pro- gram. It also can infer the compression type from files piped via the standard input. Diffstat recognizes the most popular types of output from diff: unified preferred by the patch utility. context best for readability, but not very compact. default not good for much, but simple to generate. Diffstat detects the lines that are output by diff to tell which files are compared, and then counts the markers in the first column that denote the type of change (insertion, deletion or modification). These are shown in the histogram as "+", "-" and "!" characters. If no filename is given on the command line, diffstat reads the differences from the standard input. OPTIONS
-b ignore lines matching "Binary files XXX and YYY differ" in the diff -c prefix each line of output with "#", making it a comment-line for shell scripts. -D destination specify a directory containing files which can be referred to as the result of applying the differences. diffstat will count the lines in the corresponding files (after adjusting the names by the -p option) to obtain the total number of lines in each file. The remainder, after subtracting modified and deleted lines, is shown as "unchanged lines". -e file redirect standard error to file. -f format specify the format of the histogram. 0 for concise, which shows only the value and a single histogram code for each of insert (+), delete (-) or modify (!) 1 for normal output, 2 to fill in the histogram with dots, 4 to print each value with the histogram. Any nonzero value gives a histogram. The dots and individual values can be combined, e.g., -f6 gives both. -h prints the usage message and exits. -k suppress the merging of filenames in the report. -l lists only the filenames. No histogram is generated. -m merge insert/delete counts from each "chunk" of the patch file to approximate a count of the modified lines. -n number specify the minimum width used for filenames. If you do not specify this, diffstat uses the length of the longest filename, after stripping common prefixes. -N number specify the maximum width used for filenames. Names longer than this limit are truncated on the left. If you do not specify this, diffstat next checks the -n option. -o file redirect standard output to file. -p number override the logic that strips common pathnames, simulating the patch "-p" option. -q suppress the "0 files changed" message for empty diffs. -r code provides optional rounding of the data shown in histogram, rather than truncating with error adjustments. 0 is the default. No rounding is performed, but accumulated errors are added to following columns. 1 rounds the data 2 rounds the data and adjusts the histogram to ensure that it displays something if there are any differences even if those would normally be rounded to zero. -S source this is like the -D option, but specifies a location where the original files (before applying differences) can be found. -t overrides the histogram, generates output of comma separated values. -u suppress the sorting of filenames in the report. -v show progress, e.g., if the output is redirected to a file, write progress messages to the standard error. -V prints the current version number and exits. -w number specify the maximum width of the histogram. The histogram will never be shorter than 10 columns, just in case the filenames get too large. ENVIRONMENT
Diffstat runs in a portable UNIX(R) environment. You can override the compiled-in paths of programs used for decompressing input files by setting environment variables corresponding to their name: DIFFSTAT_BZCAT_PATH DIFFSTAT_BZIP2_PATH DIFFSTAT_COMPRESS_PATH DIFFSTAT_GZIP_PATH DIFFSTAT_LZCAT_PATH DIFFSTAT_PCAT_PATH DIFFSTAT_UNCOMPRESS_PATH DIFFSTAT_ZCAT_PATH However, diffstat assumes that the resulting program uses the same command-line options, e.g., "-c" to decompress to the standard output. FILES
Diffstat is a single binary module, which uses no auxiliary files. BUGS
Diffstat makes a lot of assumptions about the format of a diff file. There is no way to obtain a filename from the standard diff between two files with no options. Context diffs work, as well as unified diffs. There's no easy way to determine the degree of overlap between the "before" and "after" displays of modified lines. diffstat simply counts the number of inserted and deleted lines to approximate modified lines for the -m option. SEE ALSO
diff (1). AUTHOR
Thomas Dickey <dickey@invisible-island.net>. DIFFSTAT(1)
All times are GMT -4. The time now is 03:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy