Sponsored Content
Top Forums Shell Programming and Scripting Awk; pattern match, remove and re write Post 302937822 by vgersh99 on Monday 9th of March 2015 05:30:36 PM
Old 03-09-2015
Code:
awk '
  FNR==NR { newf[++c]=$0; next }

/date was removed here/ {
  for(i=1; i in newf; i++)
     print newf[i]
  next
}
1
' newfile filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

want to pattern match using awk

Hello Friends, My script gives an output like below:- but i only want the red part to be displayed. how to i do that. I am enclosing my shell script after that. id='CCRCWebServerINSTALLDIR' id='AdministrationTools-CINSTALLDIR' id='AdministrationTools-ent-CINSTALLDIR'... (3 Replies)
Discussion started by: asirohi
3 Replies

2. Shell Programming and Scripting

Use to awk to match pattern, and print the pattern

Hi, I know how to use awk to search some expressions like five consecutive numbers, , this is easy. However, how do I make awk print the pattern that is been matched? For example: input: usa,canada99292,japan222,france59664,egypt223 output:99292,59664 (6 Replies)
Discussion started by: grossgermany
6 Replies

3. Shell Programming and Scripting

Remove lines from batch of files which match pattern

I need to remove all lines which does not match the pattern from a text file (batch of text files). I also need to keep the header line which is the first line of the file. Please can you provide an example for that. I used this to solve half of my work. I was unable to keep the first line of... (3 Replies)
Discussion started by: talktobog
3 Replies

4. Shell Programming and Scripting

AWK match $1 $2 pattern in file 1 to $1 $2 pattern in file2

Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match. I'm stuck in an AWK... (9 Replies)
Discussion started by: right_coaster
9 Replies

5. Shell Programming and Scripting

Awk to match a pattern and perform a search after the first pattern

Hello Guyz I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline ABC DEF LMN EFG HIJ LMN OPQ In the above text i need to... (8 Replies)
Discussion started by: RickCharles
8 Replies

6. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

7. Shell Programming and Scripting

[Solved] Pattern match and write to separate files

I need to parse a file and depending on a patern match(in the insert job line) separate files have to be created with a line added (content in file2). Mapping for pattern match and add line : for Alpha 123 for Beta 234 for Gamma 345 no match (goes into another file) File 1 ... (3 Replies)
Discussion started by: w020637
3 Replies

8. Shell Programming and Scripting

Remove multiple lines that match pattern

Not sure how I can accomplish this. I would like to remove all interfaces that have the commands I would like to see: switchport port-security, spanning-tree portfast. One line is no problem. interface FastEthernet0/8 spanning-tree portfast interface FastEthernet0/9 spanning-tree... (4 Replies)
Discussion started by: mrlayance
4 Replies

9. Shell Programming and Scripting

sed to remove newline chars based on pattern mis-match

Greetings Experts, I am in AIX; I have a file generated through awk after processing the input files. Now I need to replace or remove the new-line characters on all lines that doesn't have a ; which is the last character on the line. I tried to use sed 's/\n/ /g' After checking through the... (6 Replies)
Discussion started by: chill3chee
6 Replies

10. UNIX for Beginners Questions & Answers

awk to remove pattern and lines above pattern

In the awk below I am trying to remove all lines above and including the pattern Test or Test2. Each block is seperated by a newline and Test2 also appears in the lines to keep but it will always have additional text after it. The Test to remove will not. The awk executed until the || was added... (2 Replies)
Discussion started by: cmccabe
2 Replies
SNOWDROP(1)						      General Commands Manual						       SNOWDROP(1)

NAME
sd-eng, sd-engf, sd-c - text watermarking and watermark recovery SYNOPSIS
sd-eng [-6] -i origfile newfile "Recipient" ["Comment"] sd-eng [-6] -e origfile newfile sd-eng [-6] -l DESCRIPTION
snowdrop is a stenographic text watermarking and watermark recovery system. It is composed of three programs: sd-eng Watermark normal English text. sd-engf Watermark fine quality English text, yeilding higher quality output but encoding less information. sd-c Watermark C code. The three programs operate similarly, with the same parameters and usage. The watermark is encoded in using a number of techniques, such as whitespace reformatting, typo insertation, word substitutions, punctuation changes, and for C code, logic reordering, variable name man- gling, etc. The watermark is a md5sum, which is retreivable from as little as 5 or 10 lines of the watermarked document. Even large changes to a medium sized document should not obscure the watermark, as it is stored redundently in multiple independent channels. The three usage modes are adding a watermark, checking for the presense of a watermark, and listing the contents of your database of water- marks. Note that to later check a watermark, you must retain a copy of the original, un-watermarked file. OPTIONS
-i Inject a watermark into a file. You must pass it the original file, the filename to output the watwrmarked version to, information about who you intend the watermarked file for, and an optional comment. -e Extract a watermark from a file. Needs the original file and the new file that you suspect bears the watermark. -l Lists the contents of the watermark database. Each of the three programs will have a different list. -6 Enable 64 bit watermarking. The default is a weak 32 bit watermark. ENVIRONMENT
SD_SYNONYMS This variable can be used to point snowdrop at a customized synonyms file. FILES
~/.snowdrop/database Database of watermarked files. SEE ALSO
/usr/share/snowdrop/README Explain snowdrop in more depth, its limitations, and how to write additional watermarking modules for other tpyes of files. AUTHOR
Michal Zalewski <lcamtuf@coredump.cx> SNOWDROP(1)
All times are GMT -4. The time now is 05:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy