Sponsored Content
Top Forums Shell Programming and Scripting Replacing matched patterns in multiple files with awk Post 302964294 by karlmalowned on Wednesday 13th of January 2016 07:55:22 AM
Old 01-13-2016
This is amazing. Thank you very much Don, and I really do appreciate the details in the comments!! Smilie Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

best method of replacing multiple strings in multiple files - sed or awk? most simple preferred :)

Hi guys, say I have a few files in a directory (58 text files or somthing) each one contains mulitple strings that I wish to replace with other strings so in these 58 files I'm looking for say the following strings: JAM (replace with BUTTER) BREAD (replace with CRACKER) SCOOP (replace... (19 Replies)
Discussion started by: rich@ardz
19 Replies

2. Shell Programming and Scripting

Search multiple patterns in multiple files

Hi, I have to write one script that has to search a list of numbers in certain zipped files. For eg. one file file1.txt contains the numbers. File1.txt contains 5,00,000 numbers and I have to search each number in zipped files(The number of zipped files are around 1000 each file is 5 MB) I have... (10 Replies)
Discussion started by: vsachan
10 Replies

3. Shell Programming and Scripting

How to group matched patterns in different files

Hi, I have a master file that i need to split into multiple files based on matched patterns. sample of my data as follows:- scaff_1 a e 123 130 c_scaff_100 scaff_1 a e 132 138 c_scaff_101 scaff_1 a e 140 150 ... (2 Replies)
Discussion started by: redse171
2 Replies

4. Shell Programming and Scripting

Find matched patterns in multiple files

Hi, I need help to find matched patterns in 30 files residing in a folder simultaneously. All these files only contain 1 column. For example, File1 Gr_1 st-e34ss-11dd bt-wwd-fewq pt-wq02-ddpk pw-xsw17-aqpp Gr_2 srq-wy09-yyd9 sqq-fdfs-ffs9 Gr_3 etas-qqa-dfw ddw-ppls-qqw... (10 Replies)
Discussion started by: redse171
10 Replies

5. Shell Programming and Scripting

Find matched patterns in a column of 2 files with different size and merge them

Hi, i have input files like below:- input1 Name Seq_ID NewID Scores MT1 A0QZX3 1.65 277.4 IVO A0QZX3 1.65 244.5 HPO A0QZX3 1.65 240.5 RgP A0Q3PP 5.32 241.0 GX1 LPSZ3S 96.1 216.9 MEL LPSS3X 4.23 204.1 LDD LPSS3X 4.23 100.2 input2 Fac AddName NewID ... (9 Replies)
Discussion started by: redse171
9 Replies

6. Shell Programming and Scripting

Matched multiple patterns that could be in a same line

Hi, I need help to match pattern started with "RW" in file 1 and with pattern in $1 in file 2 as follows:- File 1 BH /TOTAL=466(423); /POSITIVE=300(257); /UNKNOWN=25(25); BH /F_P=141(141); /F_N=136; /P=4; CC /TAX=!?; /MAX-R=2; CC /VER=2; RW P9610, AR_BSU , T; PAE25, AE_E57... (10 Replies)
Discussion started by: redse171
10 Replies

7. Shell Programming and Scripting

Find matched patterns and print them with other patterns not the whole line

Hi, I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Discussion started by: redse171
3 Replies

8. Shell Programming and Scripting

Replacing multiple line patterns with awk

Hi forum, Can you please help me understand how to look for and replace the below pattern (containing line breaks) and return a new result? Rules: Must match the 3 line pattern and return a 1 line result. I have found solutions with sed, but it seems that sed installed in my system is... (5 Replies)
Discussion started by: demmel
5 Replies

9. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies

10. UNIX for Beginners Questions & Answers

Issue with search and replacing multiple items in multiple files

Im having an issue when trying to replace the first column with a new set of values in multiple files. The results from the following code only replaces the files with the last set of values in val.txt. I want to replace all the files with all the values. for date in {1..31} do for val in... (1 Reply)
Discussion started by: ncwxpanther
1 Replies
CHRONICLE(1)						User Contributed Perl Documentation					      CHRONICLE(1)

NAME
chronicle - A simple blog compiler. SYNOPSIS
chronicle [options] Path Options: --comments Specify the path to the optional comments directory. --config Specify a configuration file to read. --input Specify the input directory to use. --output Specify the directory to write output to. --theme-dir Specify the path to the theme templates. --theme Specify the theme to use. --pattern Specify the pattern of files to work with. --url-prefix Specify the prefix to the live blog. --sitemap-prefix Specify the prefix for the site map. Blog Entry Options: --format Specify the format of your entries, HTML/textile/markdown. Pre & Post-Build Commands: --pre-build Specify a command to execute prior to building the blog. --post-build Specify a command to execute once the blog has been built. --pre-filter A command to filter each blog entry before HTML conversion. --post-filter A command to filter each blog entry after HTML conversion. Sorting Options: --recent-dates-first Show recent entries first in the archive view. --recent-tags-first Show recent entries first in the tag view. Counting Options: --entry-count=N Number of posts to show on the index. --rss-count=N Number of posts to include on the RSS index feed. Optional Features: --author Specify the author's email address --comment-days Specify the number maximum age of posts to accept comments. --date-archive-path Include the date in the archive. --force Force the copying of static files from the blog theme. --lang Specify the language to use for formatting dates. --lower-case Lower-case all filenames which are output. --no-archive Don't create an archive page. --no-cache Don't use the optional memcached features, even if available. --no-calendar Don't use the optional calendar upon the index. --no-comments Don't allow comments to be posted. --no-sitemap Don't generate a sitemap. --no-tags Don't produce any tag pages. --no-xrefs Don't produce any cross references. Help Options: --help Show the help information for this script. --manual Read the manual for this script. --verbose Show useful debugging information. --version Show the version number and exit. ABOUT
Chronicle is a simple tool to convert a collection of text files, located within a single directory, into a blog consisting of static HTML files. It supports only the bare minimum of features which are required to be useful: * Tagging support. * RSS support. * Archive support. The obvious deficiencies are: * Lack of support for instant commenting. * Lack of pingback/trackback support. Having said that it is a robust, stable, and useful system. BLOG FORMAT
The format of the text files we process is critical to the output pages. Each entry should look something like this: Title: This is the title of the blog post Date: 2nd March 2007 Tags: one, two, three, long tag The text of your entry goes here. NOTE: The header MUST be separated from the body of the entry by at least a single empty line. In this example we can see that the entry itself has been prefaced with a small header. An entry header is contains three optional lines, if these are not present then there are sensible defaults as described below. The formatting of the output dates may be changed via the use of the B<--lang> command line option (or the matching "lang=french" option in the configuration file), but the date of the entry itself should be specified in English. Title: Describes the title of the post. If not present the filename of the entry is used instead. "Subject:" may also be used. Subject: This is a synonym for 'Title:'. Date: The date the post was written. If not present the creation time of the file is used instead. Publish: This header is removed from all entries, and is used by the chronicle-spooler script. Tags: Any tags which should be associated with the entry, separated by commas. The format of the entry is assumed to be HTML, however there is support for writing your entries in both textile and markdown formats. The format of entries is specified via the B<--format> argument, or via a "format: foo" setting in your chroniclerc file. The format of entries is assumed to be global; that is all your entries will be assumed to be in the same format. However you can add a "format: foo" pseudo header to specific entries if you wish to write specific entries in a different format. To allow flexibility in the handling of entries each blog entry will be passed through the filter script B<chronicle-entry-filter> which allows you to modify this handling in a single location. This script allows entries to be updated via filters both before and after the conversion to HTML. For further details please see the manpage for that script. CONFIGURATION
The configuration of the software is minimal, and generally performed via the command line arguments. However it is possible to save settings either in the file global /etc/chroniclerc or the per-user ~/.chroniclerc file. If you wish you may pass the name of another configuration file to the script with the B<--config> flag. This will be read after the previous two files, and may override any settings which are present. The configuration file contains lines like these: input = /home/me/blog output = /var/www/blog format = markdown Keys which are unknown are ignored. OPTIONAL CACHING
To speed the rebuilding of a large blog the compiler may use a local Memcached daemon, if installed and available. To install this, under a Debian GNU/Linux system please run: apt-get update apt-get install memcached libcache-memcached-perl You may disable this caching behaviour with --no-cache, and see the effect with --verbose. OPTIONAL CALENDAR
If the 'HTML::CalendarMonthSimple' module is available each blog will contain a simple month-view of the current month upon the index. To disable this invoke the program with '--no-calendar'. OPTIONAL COMMENTING
Included with the chronicle code you should find the file cgi-bin/comments.cgi. This file is designed to write submitted comments to the local filesystem of your web-server. If you install that, and edit the path at the start of the script you should be able to include comments in your blog. In short there are three things you need to do: Install the CGI script and edit the path at the start. Copy the output comments to your local blog source. Run this script again with --comments=./path/to/comments This should include the comments in the static output. More explicit instructions are provided within the file 'COMMENTS' included within the distribution. AUTHOR
Steve -- http://www.steve.org.uk/ LICENSE
Copyright (c) 2007-2010 by Steve Kemp. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. perl v5.12.3 2011-05-15 CHRONICLE(1)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy