Sponsored Content
Top Forums Shell Programming and Scripting Replicating certain lines in a textfile Post 302942586 by RudiC on Thursday 30th of April 2015 05:59:25 AM
Old 04-30-2015
Would this help:
Code:
awk     '
BEGIN           {split ("31 28 31 30 31 30 31 31 30 31 30 31", MTH)}
$0 ~ START      {TGT = NR + 1; next} 
NR==TGT         {COP = $0; next}

$0 ~ FIN        {for (i=1; i<=12; i++)
                        for (j=1; j<=MTH[i]; j++)
                                {TMP = COP
                                 M=sprintf ("%02d", i)
                                 D=sprintf ("%02d", j)
                                 sub (/MM/, M, TMP)
                                 sub (/DD/, D, TMP)
                                 printf "%s\n%s\n%s\n", START, TMP, FIN
                                }
                 next
                }
1
'  START="startCopy" FIN="endCopy" file
textline1
textline2
startCopy
copyThis0101
endCopy
.
.
.
startCopy
copyThis1231
endCopy
textline3
textline4

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

replicating restricted sam users

I'm in the process of setting up two new HP-UX 11.23 i64 servers. On my existing server (HP-UX B.11.0) we have several users defined to have restricted sam access. I'm having trouble finding those definitions and copying them over to the new servers. Is this possible - to just copy over the... (1 Reply)
Discussion started by: LisaS
1 Replies

2. AIX

Command for replicating a directory

Morning all, Is there a command on AIX that can replicate/synchronise two directories? I'm after functionality similar to robocopy on Windows. Scenario: I have a directory of Oracle forms for my production system and one for my dev system, these directories start off identical. The forms... (1 Reply)
Discussion started by: huggie
1 Replies

3. Shell Programming and Scripting

How to delete all lines with less then 32 characters from a textfile?

I need to delete all lines with less then 32 characters from a textfile. :) (15 Replies)
Discussion started by: anna428
15 Replies

4. Shell Programming and Scripting

Find a string in textfile, erase $num lines after that string

I have a textfile containing text similar to the following pattern: STRING1 UNIQUE_STRING1 STRING2 STRING3 STRING4 STRING5 STRING1 UNIQUE_STRING2 STRING2 STRING3 STRING4 STRING5 STRING1 UNIQUE_STRING3 STRING2 STRING3 (6 Replies)
Discussion started by: ilcsfe
6 Replies

5. UNIX for Dummies Questions & Answers

Replicating many rows in unix

Hi If my input is abcdefgh ijklmnop then the output should be: abcdefgh abcdefgh abcdefgh abcdefgh ijklmnop (6 Replies)
Discussion started by: pandeesh
6 Replies

6. UNIX for Dummies Questions & Answers

Replicating content using sed

if we want to replicate the content of the file twice, then we can use sed 'p' filename In the same way, if i want to replicate the content thrice or 4 times, how we can achieve in SED? Thanks (5 Replies)
Discussion started by: pandeesh
5 Replies

7. Shell Programming and Scripting

Replicating jobs, renaming outout

Can anyone tell me if it's possible to write a script that will repeat the same job several times but give the output a slightly different name each time (i.e. change or add a number at the end of the output file)? Here is the script I use to run a single job: #!/bin/bash #PBS -N job0 #PBS -l... (1 Reply)
Discussion started by: peterjb100
1 Replies

8. Shell Programming and Scripting

Cut lines from and to in a textfile

i am having a text file like below rama surya pandu latha singh raja i want to get the new file from 3 to 5 i.e pandu latha singh please help (1 Reply)
Discussion started by: suryanarayana
1 Replies

9. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies

10. UNIX for Advanced & Expert Users

Glusterfs not replicating

0 down vote favorite I have replicated glusterfs on two servers, if i create file on one server it doesnt reflect on other, if i try to heal the volume on node2 i get this error Commit failed on node2. Please check log file for details. glustershd.log E 0-test-client-3: connection to... (0 Replies)
Discussion started by: davidbob
0 Replies
ktkt_warnd(1M)						  System Administration Commands					    ktkt_warnd(1M)

NAME
ktkt_warnd - Kerberos warning daemon SYNOPSIS
/usr/lib/krb5/ktkt_warnd DESCRIPTION
ktkt_warnd is a daemon on Kerberos clients that can warn users when their Kerberos tickets are about to expire or renew the tickets before they expire. It is invoked by inetd when a ticket-granting ticket (TGT) is obtained for the first time, such as after using the kinit com- mand. ktkt_warnd can be configured through the /etc/krb5/warn.conf file on the client. In warn.conf, you can specify that you be supplied notice, through syslog or terminal or mail, of ticket expiration or to renew the TGT. FILES
/etc/krb5/warn.conf Kerberos warning configuration file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
svcs(1), inetadm(1M), inetd(1M), svcadm(1M), warn.conf(4), attributes(5), kerberos(5), smf(5) NOTES
The ktkt_warnd service is managed by the service management facility, smf(5), under the service identifier: svc:/network/security/ktkt_warn:default Administrative actions on this service, such as enabling, disabling, or requesting restart, can be performed using svcadm(1M). Responsibil- ity for initiating and restarting this service is delegated to inetd(1M). Use inetadm(1M) to make configuration changes and to view config- uration information for this service. The service's status can be queried using the svcs(1) command. SunOS 5.11 21 Mar 2005 ktkt_warnd(1M)
All times are GMT -4. The time now is 11:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy