Sponsored Content
Top Forums Shell Programming and Scripting String replacement when particular pattern matches in a file Post 302584234 by poga on Thursday 22nd of December 2011 12:05:40 PM
Old 12-22-2011
Thanks Itkamaraj , it worked. Thanks to you too Shawn for your help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace a column in a file if it matches certain pattern

Hi, I want to replace a column in a file if it matches certain pattern. Can you help me on this. Here is the file content. 000000 1111111 2222222 011111 0123445 1234556 023445 1111111 2343455 if second column contains 1111111 i need to replace it with 0000000 Can you... (6 Replies)
Discussion started by: Krrishv
6 Replies

2. 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

3. Shell Programming and Scripting

Date Pattern Match (replacement string)

Hello, i am splitting files and sometimes the string of the pattern doesnt exist in the input file it starts for example with 00:00:01. So the output is completely desorganized, is there any way of putting a replacement string in the pattern so it will grab all the times from 00:**:** to first... (0 Replies)
Discussion started by: x-plicit78
0 Replies

4. Shell Programming and Scripting

get value that matches file name pattern

Hi I have files with names that contain the date in several formats as, YYYYMMDD, DD-MM-YY,DD.MM.YY or similar combinations. I know if a file fits in one pattern or other, but i donīt know how to extract the substring contained in the file that matches the pattern. For example, i know that ... (1 Reply)
Discussion started by: pjrm
1 Replies

5. 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

6. Shell Programming and Scripting

script to delete lines from a txt file if pattern matches

File 6 dbnawldb010-b office Memphis_Corp_SQL_Diff Memphis-Corp-SQL-Inc-Application-Backup 03/09/11 03:24:04 42 luigi-b IPNRemitDB Memphis_Corp_SQL_Diff Memphis-Corp-SQL-Inc-Application-Backup 03/10/11 00:41:36 6 ebs-sqldev1-b IPNTracking Memphis_Corp_SQL_Diff... (4 Replies)
Discussion started by: ajiwww
4 Replies

7. Shell Programming and Scripting

Unix file pattern check and replacement

HI Guys , Using UNIX ,I intend to check with correct file pattern Access_file_Record.YYYYMM in path /tmp If the file exist in correct format come out from code . If not found check with different file patterns for same month period YYYYMM ( Like Access_file_Record_YYYYMM.txt or... (8 Replies)
Discussion started by: Perlbaby
8 Replies

8. Shell Programming and Scripting

Remove entire line from a file if 1st column matches a pattern

I have one requirement to delete all lines from a file if it matches below scenario. File contains three column. Employee Number, Employee Name and Employee ID Scenario is: delete all line if Employee Number (1st column) contains below 1. Non-numeric Employee Number 2. Employee Number that... (3 Replies)
Discussion started by: anshu ranjan
3 Replies

9. Shell Programming and Scripting

Extract all the sentences from a text file that matches a pattern list

Hi I have a big text file. I want to extract all the sentences that matches at least 70% (seventy percent) of the words from each sentence based on a word list called A. Say the format of the text file is as given below: This is the first sentence which consists of fifteen words... (4 Replies)
Discussion started by: my_Perl
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
Devel::REPL::Plugin::OutputCache(3pm)			User Contributed Perl Documentation		     Devel::REPL::Plugin::OutputCache(3pm)

NAME
Devel::REPL::Plugin::OutputCache - remember past results, _ is most recent SYNOPSIS
> 21 / 7 3 > _ * _ 9 > sub { die "later" } sub { die "later" } > _->() Runtime error: later DESCRIPTION
Re-using results is very useful when working in a REPL. With "OutputCache" you get "_", which holds the past result. The benefit is that you can build up your result instead of having to type it in all at once, or store it in intermediate variables. "OutputCache" also provides "$_REPL->output_cache", an array reference of all results in this session. Devel::REPL already has a similar plugin, Devel::REPL::Plugin::History. There are some key differences though: Input vs Output "History" remembers input. "OutputCache" remembers output. Munging vs Pure Perl "History" performs regular expressions on your input. "OutputCache" provides the "_" sub as a hook to get the most recent result, and "$_REPL->output_cache" for any other results. Principle of Least Surprise "History" will replace exclamation points in any part of the input. This is problematic if you accidentally include one in a string, or in a "not" expression. "OutputCache" uses a regular (if oddly named) subroutine so Perl does the parsing -- no surprises. CAVEATS
The "_" sub is shared across all packages. This means that if a module is using the "_" sub, then there is a conflict and you should not use this plugin. For example, Jifty uses the "_" sub for localization. Jifty is the only known user. SEE ALSO
"Devel::REPL", "Devel::REPL::Plugin::History" AUTHOR
Shawn M Moore, "<sartak at gmail dot com>" COPYRIGHT AND LICENSE
Copyright (C) 2007 by Shawn M Moore This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-05-08 Devel::REPL::Plugin::OutputCache(3pm)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy