Sponsored Content
Top Forums Shell Programming and Scripting Appending a text to the top of each line Post 303014798 by John K on Wednesday 21st of March 2018 08:56:42 AM
Old 03-21-2018
Thank You very much Ravinder
It works really well for my above requirement.


What if I have few words after the table name like the WHERE clause below.
Your above solution will not work for that(understandably).
What needs to be done to get it working

--Raw output

SELECT EMP_ID, CODE, NAME, AREA_MST_ID, PARENT_ID FROM SCOTT.HRTB_MASTER WHERE PSS_CREATE_DATE between SYSDATE-30 and sysdate;


--expected output

Code:
PROMPT SCOTT.HRTB_MASTER
SELECT EMP_ID, CODE, NAME, AREA_MST_ID, PARENT_ID FROM SCOTT.HRTB_MASTER WHERE PSS_CREATE_DATE between SYSDATE-30 and sysdate;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending Text To Each Line That Matches Grep

I'm currently digging for a way to append a line to a text file where each line begins with the word "setmqaut". This is a continuation of my IBM MQSeries backup script I'm working on to make my life a little easier. What I would like to do is have each line that looks like this: setmqaut -m... (4 Replies)
Discussion started by: sysera
4 Replies

2. Shell Programming and Scripting

Appending the line number and a seperator to each line of a file ?

Hi, I am a newb as far as shell scripting and SED goes so bear with me on this one. I want to basically append to each line in a file a delimiter character and the line's line number e.g Change the file from :- aaaaaa bbbbbb cccccc to:- aaaaaa;1 bbbbbb;2 cccccc;3 I have worked... (4 Replies)
Discussion started by: pjcwhite
4 Replies

3. Shell Programming and Scripting

Appending line ending with '}" to new line

Hello masters. I have a rather simple problem but its been killing me. I have a file "x" with only 1 line inside it. The line looks something like Now this is only part of the line. Its actually about 4000 characters. What i need to do is whenever there is a "}", i need to append the next... (4 Replies)
Discussion started by: aismann
4 Replies

4. UNIX for Dummies Questions & Answers

appending text on top of another file

Dear All, I have two files One is script file in which I am writing commands to append a text in a normal file. I want to insert the text on top of the file. I dont want to use sed and awk commands nor temp file. is it possible? (3 Replies)
Discussion started by: anjali
3 Replies

5. Shell Programming and Scripting

sed: appending alternate line after previous line

Hi all, I have to append every alternate line after its previous line. For example if my file has following contents line 1: unix is an OS line 2: it is open source line 3: it supports shell programming line 4: we can write shell scripts Required output should be line1: unix is an OS it is... (4 Replies)
Discussion started by: rish_max
4 Replies

6. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

7. Shell Programming and Scripting

Appending the first word of each line to the end of each line

Hi Experts, Am relatively new to shell programming so would appreciate some help in this regard. I am looking at reading from a file, line by line, picking the first word of each line and appending it to the end of the line. Any suggestions? INPUT FILE - 3735051 :... (7 Replies)
Discussion started by: hj007
7 Replies

8. Shell Programming and Scripting

Increasing a number and appending it to next line of a text file

Hi all, I have text file having a number P100. what i need is when i run a script, it should add 1 to the above number and append it to the next line of a same text file.. when i use the script next time it should check the last line and add 1 to the last number and so on.. like the text... (5 Replies)
Discussion started by: smarty86
5 Replies

9. UNIX for Dummies Questions & Answers

sed - appending text

Hey all I am trying to append a file called datebook.txt. I want to append the end of each line containing the name Fred with three ***. I believe I need to make the * loose its meta character meaning in addition to using the append command. I have tried several variations of this command and I... (3 Replies)
Discussion started by: citizencro
3 Replies

10. Shell Programming and Scripting

Grabbing top line of text in a file and setting it to a variable

If I have a txt file with test.txt somelineoftext and I want to set that line of text to variable in a script: so #!/bin/bash var='' becomes #!/bin/bash var='somelineoftext' (3 Replies)
Discussion started by: digitalviking
3 Replies
SQL::Abstract::Tree(3)					User Contributed Perl Documentation				    SQL::Abstract::Tree(3)

NAME
SQL::Abstract::Tree - Represent SQL as an AST SYNOPSIS
my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' }); print $sqla_tree->format('SELECT * FROM foo WHERE foo.a > 2'); # SELECT * # FROM foo # WHERE foo.a > 2 METHODS
new my $sqla_tree = SQL::Abstract::Tree->new({ profile => 'console' }); $args = { profile => 'console', # predefined profile to use (default: 'none') fill_in_placeholders => 1, # true for placeholder population placeholder_surround => # The strings that will be wrapped around [GREEN, RESET], # populated placeholders if the above is set indent_string => ' ', # the string used when indenting indent_amount => 2, # how many of above string to use for a single # indent level newline => " ", # string for newline colormap => { select => [RED, RESET], # a pair of strings defining what to surround # the keyword with for colorization # ... }, indentmap => { select => 0, # A zero means that the keyword will start on # a new line from => 1, # Any other positive integer means that after on => 2, # said newline it will get that many indents # ... }, } Returns a new SQL::Abstract::Tree object. All arguments are optional. profiles There are four predefined profiles, "none", "console", "console_monochrome", and "html". Typically a user will probably just use "console" or "console_monochrome", but if something about a profile bothers you, merely use the profile and override the parts that you don't like. format $sqlat->format('SELECT * FROM bar WHERE x = ?', [1]) Takes $sql and "@bindargs". Returns a formatting string based on the string passed in parse $sqlat->parse('SELECT * FROM bar WHERE x = ?') Returns a "tree" representing passed in SQL. Please do not depend on the structure of the returned tree. It may be stable at some point, but not yet. unparse $sqlat->unparse($tree_structure, @bindargs) Transform "tree" into SQL, applying various transforms on the way. format_keyword $sqlat->format_keyword('SELECT') Currently this just takes a keyword and puts the "colormap" stuff around it. Later on it may do more and allow for coderef based transforms. pad_keyword my ($before, $after) = @{$sqlat->pad_keyword('SELECT')}; Returns whitespace to be inserted around a keyword. fill_in_placeholder my $value = $sqlat->fill_in_placeholder(@bindargs) Removes last arg from passed arrayref and returns it, surrounded with the values in placeholder_surround, and then surrounded with single quotes. indent Returns as many indent strings as indent amounts times the first argument. ACCESSORS
colormap See "new" fill_in_placeholders See "new" indent_amount See "new" indent_string See "new" indentmap See "new" newline See "new" placeholder_surround See "new" perl v5.18.2 2014-01-16 SQL::Abstract::Tree(3)
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy