Sponsored Content
Top Forums Shell Programming and Scripting Appending a text to the top of each line Post 303014803 by RudiC on Wednesday 21st of March 2018 09:36:19 AM
Old 03-21-2018
You could extend Ravindersingh13's proposal to
- work on upper and lower case keywords, both of which are allowed in SQL
- eliminate the trailing semicolon if where clause is missing
- keep empty lines for "paragraph separation"
like
Code:
awk 'NF {val=$0;gsub(/.*[fF][rR][oO][mM] | [wW][hH][eE][rR][eE].*|;$/,"",val);print "PROMPT",val} 1'  file

This User Gave Thanks to RudiC For This Post:
 

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
X11Font(3)						User Contributed Perl Documentation						X11Font(3)

NAME
Tk::Font - a class for finding X Fonts SYNOPSIS
use Tk::X11Font; $font = $widget->X11Font(foundry => 'adobe', family => 'times', point => 120 ); $font = $widget->X11Font('*-courier-medium-r-normal-*-*'); DESCRIPTION
This module can be use to interrogate the X server what fonts are avaliable. METHODS
Foundry( [ $val ] ) Family( [ $val ] ) Weight( [ $val ] ) Slant( [ $val ] ) Swidth( [ $val ] ) Adstyle( [ $val ] ) Pixel( [ $val ] ) Point( [ $val ] ) Xres( [ $val ] ) Yres( [ $val ] ) Space( [ $val ] ) Avgwidth( [ $val ] ) Registry( [ $val ] ) Encoding( [ $val ] ) Set the given field in the font name to $val if given and return the current or previous value Name( [ $max ] ) In a list context it returns a list of all font names that match the fields given. It will return a maximum of $max names, or 128 if $max is not given. In a scalar contex it returns the first matching name or undef Clone( [ key => value, [ ...]] ) Create a duplicate of the curent font object and modify the given fields AUTHOR
Graham Barr <Graham.Barr@tiuk.ti.com> HISTORY
11-Jan-96 Initial version 08-Nov-98 Renamed for Tk800.012 COPYRIGHT
Copyright (c) 1995-1996 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2007-05-05 X11Font(3)
All times are GMT -4. The time now is 10:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy