Sponsored Content
Top Forums Shell Programming and Scripting Adding additional characters while preserving original text Post 302472907 by pchang on Thursday 18th of November 2010 11:16:50 AM
Old 11-18-2010
Adding additional characters while preserving original text

Hi Forum.

I'm struggling on this relatively easy request to add additional 4 0's to an existing text in a file (whenever I see the pattern -# where # represents any number) using sed command while preserving the rest of the text in the files.

Code:
Original Text:
[s_m_f_acct_key_meas_daily]
$DBConnection_EDW=SAS2EDW
$$startdate=to_char(sysdate-9, 'j')
$$enddate=to_char(sysdate, 'j')

[s_m_f_acct_txn]
$PMSessionLogFile=$PMRootDir/Logs/AUTO.S_M_F_ACCT_TXN.LOG
$DBConnection_EDW=SAS2EDW
$$startdate=to_char(sysdate-10,'j')
$$enddate=to_char(sysdate, 'j')

Final Text:
[s_m_f_acct_key_meas_daily]
$DBConnection_EDW=SAS2EDW
$$startdate=to_char(sysdate-90000, 'j')
$$enddate=to_char(sysdate, 'j')

[s_m_f_acct_txn]
$PMSessionLogFile=$PMRootDir/Logs/AUTO.S_M_F_ACCT_TXN.LOG
$DBConnection_EDW=SAS2EDW
$$startdate=to_char(sysdate-100000,'j')
$$enddate=to_char(sysdate, 'j')

Any help is greatly appreciated.

Thank you.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding an additional harddrive in solaris 9

Hello, I have a system which a new harddrive was installed for additional space. I now need to mount the drive and transfer data from /home to the new drive with a mount point named /home. How do I go about doing this? Thanks in advance. (5 Replies)
Discussion started by: GLJ@USC
5 Replies

2. UNIX for Advanced & Expert Users

adding additional drive to sco the is xenix

I am taking an old xenix drive and installing it in a recent SCO Build Server. I have gone through the process of running mkdev hd twice since the drive is a SCSI then proceed to run mkdev fs and when I attempt to add one of the shown partitions I get the following: fsck: cannot determine... (1 Reply)
Discussion started by: justenglabs
1 Replies

3. Shell Programming and Scripting

Adding additional column at the end

I have a file like below. The separator between reconds is ">" Each record consists of 2 numbers separated by a space. I want to write an awk script that copies the second number and puts it in the third column. :rolleyes: > 10 0 13 5.92346 16 10.3106 19 13.9672 22 16.9838 25... (5 Replies)
Discussion started by: kristinu
5 Replies

4. Shell Programming and Scripting

Adding text to file on certain lines with(special characters)

I need to add "new lines" of text with special characters, to specific lines in the file. There are 3 modifications needed. Been testing 2 here without success. #!/usr/bin/perl use FileHandle; $file=FileHandle->new; $FILENAME="/opt/etc/usr/file.txt"; $file->open ("<$FILENAME") or die... (13 Replies)
Discussion started by: A4ron4perl
13 Replies

5. Shell Programming and Scripting

Help in preserving special characters from input file

Hi Forum. I've tried to search online for a solution but I cannot seem to find one. Hopefully, someone here can help me out. I would appreciate it. Input file abc.txt: $InputFile_Borrower=CMTSLST\EDW_COMMERCIAL_MTGE_BORROWER_dat.lst... (14 Replies)
Discussion started by: pchang
14 Replies

6. AIX

Any Additional Steps After Adding New RAM To Sever?

Hi All, We have a server at a client site running AIX 5.3, which we just up the RAM to 32GB, from initially 16GB (if I'm not mistaken). This server is our Application server running J2EE applications on top of Oracle Internet Application Server. Recently we encountered one of the batch jobs... (12 Replies)
Discussion started by: a_sim
12 Replies

7. Shell Programming and Scripting

Adding an additional blank field to a file

Hi, I have the following file, I'd like to add an additional blank field to this file This is a tab delimited file, I have tried the same thing on excel, but looking for a unix solution. Here is my input: Country Postal Admin4 StreetBaseName StreetType HUN 2243 Kóka Dózsa György ... (3 Replies)
Discussion started by: ramky79
3 Replies

8. Red Hat

Adding Additional Capacity with megacli

I'm trying to add 6 more hard drives to my RAID array, none of the drives are foreign, they won't be replacing any drives either. I just need to add them to the RAID array. I can't seem to get them added, what am I missing? ---------- Post updated 08-03-12 at 12:28 PM ---------- Previous... (0 Replies)
Discussion started by: eccentricson
0 Replies

9. Shell Programming and Scripting

Variable being stored with additional characters

I am trying to store a string value to a temporary variable within my script. When I run the command manually it returns the expected value, but from the script an additional "\r" is at the end. tCurrentStatus=`cat ${tPC_status} | grep 'Current status' | awk '{print $NF}'` output: cat... (1 Reply)
Discussion started by: jxrst
1 Replies
MicroMason::Debug(3pm)					User Contributed Perl Documentation				    MicroMason::Debug(3pm)

NAME
Text::MicroMason::Debug - Provide developer info via warn SYNOPSIS
Instead of using this class directly, pass its name to be mixed in: use Text::MicroMason; my $mason = Text::MicroMason->new( -Debug ); Use the standard compile and execute methods to parse and evalute templates: print $mason->compile( text=>$template )->( @%args ); print $mason->execute( text=>$template, @args ); You'll see lots of warning output on STDERR: MicroMason Debug create: Text::MicroMason::Base::AUTO::Debug... MicroMason Debug source: q(Hello <% $noun %>!) MicroMason Debug lex: text, q(Hello ), expr, q( $noun ), text, q(!) MicroMason Debug eval: sub { my @OUT; my $_out = sub { push ... DESCRIPTION
This package provides numerous messages via warn for developer use when debugging templates built with Text::MicroMason. Supported Attributes debug Activates debugging messages for many methods. Defaults to logging everything. Can be set to 0 or 1 to log nothing or everything. Alternately, set this to a hash reference containing values for the steps you are interested in to only log this items: debug => { source => 1, eval => 1 } You can also selectively surpress some warnings: debug => { default => 1, source => 0, eval => 0 } Private Methods debug_msg Called to provide a debugging message for developer reference. No output is produced unless the object's 'debug' flag is true. SEE ALSO
For an overview of this templating framework, see Text::MicroMason. This is a mixin class intended for use with Text::MicroMason::Base. For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe. perl v5.10.1 2007-01-29 MicroMason::Debug(3pm)
All times are GMT -4. The time now is 12:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy