Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Need to auto increment Post 302883709 by graphi on Wednesday 15th of January 2014 05:35:48 PM
Old 01-15-2014
looks like the nawk did the trick.

THANKS!

---------- Post updated at 03:35 PM ---------- Previous update was at 01:12 PM ----------

For some reason this isn't working correctly.

I'm calling it like so... for ease of space, I will just call the file names fileA and fileB

Quote:
nawk '/Insert/{print "prompt Inserting " ++c; print $0}' fileA > fileB
I've also tried >> instead of >

What I'm seeing is:
Quote:
prompt Inserting 1
Insert into FS_NRIS_NVUM.NRN_STRATA
prompt Inserting 2
Insert into FS_NRIS_NVUM.NRN_STRATA
That's it..that's the full content.

What I should be seeing 111372 versions of:
Quote:
prompt Inserting 1
Insert into FS_NRIS_NVUM.NRN_STRATA
(STRATA_CN, SITE_CN_FK, STARTDATE, ENDDATE, MON,
TUES, WED, THUR, FRI, SAT,
SUN, USERNAME, C, N, L,
M, H, V, FINAL, LAST_UPDATE,
VPDUNIT_ID)
Values
('D46067E0975848E8E040DDA54F2A76BE', 'D46067E0975648E8E040DDA54F2A76BE', TO_DATE('10/01/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('10/1
2/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'L',
'L', 'L', 'L', 'L', 'L',
'L', 'TFRASER', 0, 0, 12,
0, 0, 0, 'Y', TO_TIMESTAMP_TZ('2/7/2013 4:23:26.000000 AM -06:00','fmMMfm/fmDDfm/YYYY fmHH12fm:MI:SS.FF AM TZH:TZM'),
'0407');
What am I doing wrong?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

increment an integer

hi I want to echo the variable $i while it auto-increments till 21 I set initially i to 1 any idea how to do that? thank you (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

2. Shell Programming and Scripting

Increment value (starttime)

Hi All, I have created a script... #!/bin/sh datafile=ABC2008101601.OUT indfile=ABCIND20081016.1.OUT waittime=600 starttime=0 while do if then echo "Indicator file has arrived." break else sleep 10; ((starttime=$starttime+10)) echo $starttime (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

3. Shell Programming and Scripting

auto increment

Hello Does anyone know how to auto-increment the value of a variable, preferably using awk or sed? I need to read values from a file and auto-increment those values to use them as line numbers I'd be doing: while read line do # auto-increment sed -n${line}p file> file1 done... (6 Replies)
Discussion started by: loperam
6 Replies

4. Shell Programming and Scripting

Increment in date

Hi, I have a variable lets say DATA_DATE. I have to pass some value to this variable in YYYYMMDD format. lets say today I have passed this variable as : DATA_DATE=20100107 Then pls help me how to calculate another variable DATA_DATE1 (which is DATA_DATE+1). The code should work... (3 Replies)
Discussion started by: 46019
3 Replies

5. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

6. UNIX for Dummies Questions & Answers

[Solved] auto sftp

i was able to script: ftp -n hosname << DONE user username pwd put quite close DONE can i do same as sftp ? i tried, but it keeps asking for pwd. when i typed pwd, and it worked fine. (11 Replies)
Discussion started by: lawsongeek
11 Replies

7. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

8. Shell Programming and Scripting

Increment the password value

I want a script which increments the count when the script runs. Basically I want to send an password reset email notification for an application, the password value should be keep on changing whenever the script is executed for example, first time i execute it should be password1, second time... (2 Replies)
Discussion started by: JAGADESH GN
2 Replies

9. UNIX for Beginners Questions & Answers

Howto auto boot SPARC | How to auto supply "start /SYS" and "start /SP/console" commands

When I power ON my T4-1, I got a prompt -> where I have to start /SYS and start /SP/console. How can I auto supply these two commands ? (3 Replies)
Discussion started by: z_haseeb
3 Replies
page_util_quote(n)					      Parser generator tools						page_util_quote(n)

__________________________________________________________________________________________________________________________________________________

NAME
page_util_quote - page character quoting utilities SYNOPSIS
package require page::util::quote ?0.1? package require snit ::page::util::quote::unquote char ::page::util::quote::quote'tcl char ::page::util::quote::quote'tclstr char ::page::util::quote::quote'tclcom char _________________________________________________________________ DESCRIPTION
This package provides a few utility commands to convert characters into various forms. API
::page::util::quote::unquote char A character, as stored in an abstract syntax tree by a PEG processor (See the packages grammar::peg::interpreter, grammar::me, and their relations), i.e. in some quoted form, is converted into the equivalent Tcl character. The character is returned as the result of the command. ::page::util::quote::quote'tcl char This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser, will regenerate the character in question and is 7bit ASCII. The string is returned as the result of this command. ::page::util::quote::quote'tclstr char This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser and will generate a human readable representation of the character in question. The string is returned as the result of this command. The string does not use any unprintable characters. It may use backslash-quoting. High UTF characters are quoted to avoid problems with the still prevalent ascii terminals. It is assumed that the string will be used in a double-quoted environment. ::page::util::quote::quote'tclcom char This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser when used within a Tcl comment. The string is returned as the result of this command. BUGS, IDEAS, FEEDBACK This document, will undoubtedly contain bugs and other problems. Please report such in the category page of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have. KEYWORDS
page, parser generator, quoting, text processing CATEGORY
Page Parser Generator COPYRIGHT
Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net> page 1.0 page_util_quote(n)
All times are GMT -4. The time now is 03:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy