Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Shell Script for displaying the line till the target word Post 302834805 by Kalaiselvi66 on Saturday 20th of July 2013 02:56:09 AM
Old 07-20-2013
Shell Script for displaying the line till the target word

" Script for display sentences with special character"
Hi,

Could any one share a command how to display a line until my target word.
For ex: My file has the content as:

Code:
select * from db_wrk where col1 < col2
insert into table_name values('1','2','tst','wrk','dev','prod')

My target search word is : wrk

Required Output is: 1
Code:
----------------------
select * from db_wrk 
insert into table_name values('1','2','tst','wrk',

It will be so good,if anyone share the command to display the output is:

Required Output is: 2
Code:
----------------------
select * from ^^^^^^db_wrk^^^^^ 
insert into table_name values('1','2','tst','^^^^^wrk^^^^',


Thanks in advance

Last edited by Scrutinizer; 07-20-2013 at 04:27 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. Shell Programming and Scripting

Shell script to parse a line and insert a word

Hi All, I have a file like this, data1,data2,,,data5,data6. i want to write a shell script to replace data3 with "/example/string". which means my data file should look like this . data1,data2,example/string],,data5,data6. Could you guys help me to get a sed command or any other command... (8 Replies)
Discussion started by: girish.raos
8 Replies

3. Shell Programming and Scripting

Awk script to match pattern till blank line

Hi, I need to match lines after a pattern, upto the first blank line. Searched in web and some forums but coulnt find the answer. where <restart_step> = 10 -- Execute query 20 -- Write the contents to the Oracle table 30 -- Writing Contents to OUTPUT... (7 Replies)
Discussion started by: justchill
7 Replies

4. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

5. Shell Programming and Scripting

how to convert a shell script to a php script for displaying next word after pattern match

I have a shell script which I made with the help of this forum #!/bin/sh RuleNum=$1 cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}' Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies

6. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

7. Shell Programming and Scripting

Fetch entries in front of specific word till next word

Hi all I have following file which I have to edit for research purpose file:///tmp/moz-screenshot.png body, div, table, thead, tbody, tfoot, tr, th, td, p { font-family: &quot;Liberation Sans&quot;; font-size: x-small; } Drug: KRP-104 QD Drug: Placebo Drug: Metformin|Drug:... (15 Replies)
Discussion started by: Priyanka Chopra
15 Replies

8. Shell Programming and Scripting

Displaying text till pattern match found in a line

Hi All, From the below line if we want to display all the text till found pattern dot/. I was trying with the below code but couldn't able to print text before the pattern. it display texts which is found after pattern. awk '/assed/{print;getline;print}' file_name | sed 's/^*. *//' input... (4 Replies)
Discussion started by: Optimus81
4 Replies

9. Shell Programming and Scripting

Shell for displaying specific records from a line.

Input file. GMDCOM.27936 : Process Request <36812974> GMDCOM.27936 : Process Request <36812985> GMDCOM.27936 : Process Request <36812986> GMDCOM.27936 : Process Request <36812987> GMDCOM.27936 : Process Request <36812996> GMDCOM.27936 : Process Request <36812998> GMDCOM.27936 : Process... (14 Replies)
Discussion started by: ghosh_tanmoy
14 Replies

10. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies
MALAGA(1)						      Malaga quick reference							 MALAGA(1)

NAME
malaga - natural-language word and sentence analysis SYNOPSIS
malaga [-morphology|-syntax] [-quoted] [-input input] project-file DESCRIPTION
Malaga is a development environment for natural-language grammars based on the Left-Associative Grammar formalism. Malaga grammars can be used for automatic morphological and/or syntactic analysis. The program malaga is Malaga's user interface for analysing word forms and sentences, displaying the results and finding bugs in a grammar. malaga requires the name of a language-dependent project-file as a command-line argument. If no command line options are given, malaga starts in interactive mode, and you can enter commands. If you are not sure about the name of a command, use the command help to get an overview of all malaga commands. If you want to quit malaga, enter the command quit. See info Malaga for details. OPTIONS
-h[elp] Print a help text about malaga's command line arguments and exit. -i[nput] input Analyse a single word or sentence given as command line argument (only valid in morphology or syntax mode). -m[orphology] Start malaga in morphology mode. In this mode word forms are read in from the standard input stream and analysed (one word form per line). The analysis result are written to the standard output stream. -q[uoted] The input lines to be analysed are quoted (only valid in morphology or syntax mode). -s[yntax] Start malaga in syntax mode. In this mode sentences are read in from the standard input stream and analysed (one sentence per line). The analysis result is written to the standard output stream. -v[ersion] Print malaga's version number and exit. AUTHORS
Malaga was written by Bjoern Beutel. Numerous other people distributed to Malaga. This manpage was originally written for the Debian dis- tribution by Antti-Juhani Kaijanaho. SEE ALSO
mallex(1), malmake(1), malrul(1), malshow(1), malsym(1) ``Malaga 7, User's and Programmer's Manual''. Available in Debian systems via info Malaga, and, if the malaga-doc package is installed, in various formats (DVI, Postscript, PDF, HTML) under /usr/share/doc/malaga-doc/. Malaga 26 September 2006 MALAGA(1)
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy