Sponsored Content
Top Forums Shell Programming and Scripting Modify one line in a plain text file Post 302760207 by Xedrox on Wednesday 23rd of January 2013 03:18:16 PM
Old 01-23-2013
Nice! Supose other situation, the first parameter is nor the number of line, it is a string. For example:

Code:
CONFIGURATION_1=XXXX
CONFIGURATION_2=YYYY
CONFIGURATION_3=ZZZZ

supose i have a command or function "modify" that takes a file and modficates one line. "Modify" takes two arguments, a string and the new value. I want replace the line that contains a string "CONFIGURATION_2" with the value "CONFIGURATION_2=XXXX". Something like grep but writting.


Code:
#script
modify CONFIGURATION_2 CONFIGURATION_2=XXXX

The result that i want on the file:


Code:
CONFIGURATION_1=XXXX
CONFIGURATION_2=XXXX
CONFIGURATION_3=ZZZZ

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Modify a text or xml file

Hi all, I want to write a shell which would allow me to edit a text file or a xml file. Basically i want to add a new node in a existing xml file. The values for this new node are based on user input. Thanks in advance Zing (9 Replies)
Discussion started by: zing
9 Replies

2. Shell Programming and Scripting

Modify Specific Line of a Text File

Given a text file, how do you add a line of text after a specific line number? I believe I would want to use "sed" but I am unsure of the syntax. Thank you. Mike (5 Replies)
Discussion started by: msb65
5 Replies

3. Shell Programming and Scripting

Need help to modify perl script: Text file with line and more than 1 space

Dear Friends, I am beginner in Perl and trying to find the problem in a script. Kindly help me to modify the script. My script is not giving the output for the last field and followed text (LA: Language English). Input file & script as follows: Input file: Thu Mar 19 2:34:14 EDT 2009 STC... (3 Replies)
Discussion started by: srsahu75
3 Replies

4. UNIX for Dummies Questions & Answers

Modify Text File

Hi, I would like to remove any lines from a text file that begin with #, or that are blank. How can I do that with BASH? Mike (3 Replies)
Discussion started by: msb65
3 Replies

5. Shell Programming and Scripting

from one word for line to plain text

Hello! I've got a very big file (from tokenization) which has one word for line. How is it possible then to rebuild the "original" text, knowing that <s> and </s> are the sentence-delimiters? My file looks like this: <s> && tanzania na Afrika kwa ujumla ambiwa na taifa kubwa... (6 Replies)
Discussion started by: mjomba
6 Replies

6. Shell Programming and Scripting

Modify the text file by script

Hi All the Helpers! I have a text file which looks like input.txt.I would request to please suggest me how can I make this file look like output.txt input.txt VOP 111 0 1 2 DEM 111 0 222 333 444 555 879 888 987 888 989 VOP 118 0... (2 Replies)
Discussion started by: Indra2011
2 Replies

7. Shell Programming and Scripting

Modify text file using awk

I have text file with lines as shown here. Each row has 11 columns separated by tab. In each row, i want to split the 8th column such that the output should look like shown below. Here value in the 9th column is DP value and in the 10th column is MQ value followed by the values after resource.EFF=.... (15 Replies)
Discussion started by: mehar
15 Replies

8. Shell Programming and Scripting

Sum numeric columns contained in a plain text file

Hi everyone, Here are the contents of a plain text file created by a SQL query: SUM(T.TRNQTY) COUNT(D.TRNSEQ) ---------------- ---------------- 1380 46 1393 59 2680 134 740 37 ... (5 Replies)
Discussion started by: gacanepa
5 Replies

9. Shell Programming and Scripting

Modify text file using sed

Hello all, I have some text files I need to do the following on: Delete banner page (lines 1-56) --I am doing this using sed Remove ^M --I am doing this using vi Remove trailer page --this can vary based on the contents of the file, it usually starts with *************************** I am... (5 Replies)
Discussion started by: jeffs42885
5 Replies

10. UNIX for Beginners Questions & Answers

Modify text file if found multiple pattern match for every line.

Looking for help, i have input file like below and want to modify to expected output, if can without create additional file, hope can direct modify it. have 2 thing need do. 1st is adding a word (testplan generation off) after ! ! IPG: Tue Aug 07 14:31:17 2018 2nd is adding... (16 Replies)
Discussion started by: kttan
16 Replies
DateTime::Locale::pa_Arab(3)				User Contributed Perl Documentation			      DateTime::Locale::pa_Arab(3)

NAME
DateTime::Locale::pa_Arab SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'pa_Arab' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Punjabi Arabic. DATA
This locale inherits from the DateTime::Locale::pa locale. It contains the following data. Days Wide (format) XXX XXXX XXXX XXXXXX XXXX XXXX XXXXX Abbreviated (format) XXX XXXX XXXX XXXXXX XXXX XXXX XXXXX Narrow (format) XX XX XXX XX XXXX XX X Wide (stand-alone) XXX XXXX XXXX XXXXXX XXXX XXXX XXXXX Abbreviated (stand-alone) XXX XXXX XXXX XXXXXX XXXX XXXX XXXXX Narrow (stand-alone) XX XX XXX XX XXXX XX X Months Wide (format) XXXXX XXXXX XXXX XXXXX XX XXX XXXXXX XXXX XXXXX XXXXXX XXXXX XXXXX Abbreviated (format) XXXXX XXXXX XXXX XXXXX XX XXX XXXXXX XXXX XXXXX XXXXXX XXXXX XXXXX Narrow (format) X X XX X X XX XX X X X X X Wide (stand-alone) XXXXX XXXXX XXXX XXXXX XX XXX XXXXXX XXXX XXXXX XXXXXX XXXXX XXXXX Abbreviated (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Narrow (stand-alone) X X XX X X XX XX X X X X X Quarters Wide (format) XXXXXX XXXXX XXXXXX XXXX XXXXXX XXXX XXXXXX XXXXX Abbreviated (format) XXXXXX XXXXX XXXXXX XXXX XXXXXX XXXX XXXXXX XXXXX Narrow (format) 1 2 3 4 Wide (stand-alone) XXXXXX XXXXX XXXXXX XXXX XXXXXX XXXX XXXXXX XXXXX Abbreviated (stand-alone) XXXXXX XXXXX XXXXXX XXXX XXXXXX XXXX XXXXXX XXXXX Narrow (stand-alone) 1 2 3 4 Eras Wide XXXXXXXX XX Abbreviated XXXXXXXX XX Narrow XXXXXXXX XX Date Formats Full 2008-02-05T18:30:30 = XXXX, 05 XXXXX 2008 1995-12-22T09:05:02 = XXXX, 22 XXXXX 1995 -0010-09-15T04:44:23 = XXXX, 15 XXXXX -10 Long 2008-02-05T18:30:30 = 5 XXXXX 2008 1995-12-22T09:05:02 = 22 XXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXX -10 Medium 2008-02-05T18:30:30 = 5 XXXXX 2008 1995-12-22T09:05:02 = 22 XXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXX -10 Short 2008-02-05T18:30:30 = 05/02/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/09/-010 Default 2008-02-05T18:30:30 = 5 XXXXX 2008 1995-12-22T09:05:02 = 22 XXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXX -10 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 XXXX UTC 1995-12-22T09:05:02 = 9:05:02 XXXXX UTC -0010-09-15T04:44:23 = 4:44:23 XXXXX UTC Long 2008-02-05T18:30:30 = 6:30:30 XXXX UTC 1995-12-22T09:05:02 = 9:05:02 XXXXX UTC -0010-09-15T04:44:23 = 4:44:23 XXXXX UTC Medium 2008-02-05T18:30:30 = 6:30:30 XXXX 1995-12-22T09:05:02 = 9:05:02 XXXXX -0010-09-15T04:44:23 = 4:44:23 XXXXX Short 2008-02-05T18:30:30 = 6:30 XXXX 1995-12-22T09:05:02 = 9:05 XXXXX -0010-09-15T04:44:23 = 4:44 XXXXX Default 2008-02-05T18:30:30 = 6:30:30 XXXX 1995-12-22T09:05:02 = 9:05:02 XXXXX -0010-09-15T04:44:23 = 4:44:23 XXXXX Datetime Formats Full 2008-02-05T18:30:30 = XXXX, 05 XXXXX 2008 6:30:30 XXXX UTC 1995-12-22T09:05:02 = XXXX, 22 XXXXX 1995 9:05:02 XXXXX UTC -0010-09-15T04:44:23 = XXXX, 15 XXXXX -10 4:44:23 XXXXX UTC Long 2008-02-05T18:30:30 = 5 XXXXX 2008 6:30:30 XXXX UTC 1995-12-22T09:05:02 = 22 XXXXX 1995 9:05:02 XXXXX UTC -0010-09-15T04:44:23 = 15 XXXXX -10 4:44:23 XXXXX UTC Medium 2008-02-05T18:30:30 = 5 XXXXX 2008 6:30:30 XXXX 1995-12-22T09:05:02 = 22 XXXXX 1995 9:05:02 XXXXX -0010-09-15T04:44:23 = 15 XXXXX -10 4:44:23 XXXXX Short 2008-02-05T18:30:30 = 05/02/2008 6:30 XXXX 1995-12-22T09:05:02 = 22/12/1995 9:05 XXXXX -0010-09-15T04:44:23 = 15/09/-010 4:44 XXXXX Default 2008-02-05T18:30:30 = 5 XXXXX 2008 6:30:30 XXXX 1995-12-22T09:05:02 = 22 XXXXX 1995 9:05:02 XXXXX -0010-09-15T04:44:23 = 15 XXXXX -10 4:44:23 XXXXX Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 XXXX 1995-12-22T09:05:02 = 22 XXXX -0010-09-15T04:44:23 = 15 XXXX HHmmss (HH:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 XXXX 1995-12-22T09:05:02 = 9:05 XXXXX -0010-09-15T04:44:23 = 4:44 XXXXX Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 XXXX 1995-12-22T09:05:02 = 9:05:02 XXXXX -0010-09-15T04:44:23 = 4:44:23 XXXXX M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d/M) 2008-02-05T18:30:30 = 5/2 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/9 MEd (E, M-d) 2008-02-05T18:30:30 = XXXX, 2-5 1995-12-22T09:05:02 = XXXX, 12-22 -0010-09-15T04:44:23 = XXXX, 9-15 MMM (LLL) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 MMMd (MMM d) 2008-02-05T18:30:30 = XXXXX 5 1995-12-22T09:05:02 = XXXXX 22 -0010-09-15T04:44:23 = XXXXX 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = XXXX XXXXX 5 1995-12-22T09:05:02 = XXXX XXXXX 22 -0010-09-15T04:44:23 = XXXX XXXXX 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = XXXXX 5 1995-12-22T09:05:02 = XXXXX 22 -0010-09-15T04:44:23 = XXXXX 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = XXXX XXXXX 5 1995-12-22T09:05:02 = XXXX XXXXX 22 -0010-09-15T04:44:23 = XXXX XXXXX 15 mmss (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = XXXX, 2008-2-5 1995-12-22T09:05:02 = XXXX, 1995-12-22 -0010-09-15T04:44:23 = XXXX, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 XXXXX 1995-12-22T09:05:02 = 1995 XXXXX -0010-09-15T04:44:23 = -10 XXXXX yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = XXXX, 2008 XXXXX 5 1995-12-22T09:05:02 = XXXX, 1995 XXXXX 22 -0010-09-15T04:44:23 = XXXX, -10 XXXXX 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 XXXXX 1995-12-22T09:05:02 = 1995 XXXXX -0010-09-15T04:44:23 = -10 XXXXX yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 XXXXXX XXXXX 1995-12-22T09:05:02 = 1995 XXXXXX XXXXX -0010-09-15T04:44:23 = -10 XXXXXX XXXX yyMMM (MMM yy) 2008-02-05T18:30:30 = XXXXX 08 1995-12-22T09:05:02 = XXXXX 95 -0010-09-15T04:44:23 = XXXXX -10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 Miscellaneous Prefers 24 hour time? No Local first day of the week XXX SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::pa_Arab(3)
All times are GMT -4. The time now is 07:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy