Sponsored Content
Top Forums Shell Programming and Scripting Finding pattern & prepending a line with text Post 302079505 by kirrushna on Tuesday 11th of July 2006 02:12:15 AM
Old 07-11-2006
Hammer & Screwdriver Finding pattern & prepending a line with text

Hello Dudes,

I have a task to make a unix shell script that should search for a
specific TEXT in a file.If that TEXT is found, shell script should add
a comment statement before that TEXT line.

Ex : LINE 1 xxxxx
LINE 2 xxxx CALL xxxx
LINE 3 xxxx PERFORM UNTIL

if i am looking for CALL as TEXT then shell script should add
comment statement after LINE 1.

Can somebody help me with that?

Thanks in advance
krishna

"Without GOD i cannot,Without ME god will not"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with finding & replacing pattern in a file

Hi everyone. Could u be so kind and help me with on "simple" shell script? 1. i need to search a file line by line for a pattern. example of a lines in that file 2947 domain = feD,id = 00 0A 02 48 17 1E 1D 39 DE 00 0E 00,Name Values:snNo = f10 Add AttFlag = 0 2. i need to find... (0 Replies)
Discussion started by: dusoo
0 Replies

2. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

3. Shell Programming and Scripting

Finding a flatfile & deleting first line

I have a small script where I want to see if a file exists & then delete the first line from it. I have code to help me find if the file exists, but I am unsure as to how to then take in the answer and remove the first line from the flatfile: This is what I have so far just to output if the... (3 Replies)
Discussion started by: fatalxkiss
3 Replies

4. Shell Programming and Scripting

Conditionally prepending text

I am currently writing a script to compare a file list created over an FTP connection to a local directory. I have cleaned the FTP file list up so that I just have a raw list of filenames however due to the directory structure employed (both locally and on the ftp site) I need to prepend each line... (6 Replies)
Discussion started by: Dal
6 Replies

5. Shell Programming and Scripting

Help required on joining one line above & below to the pattern matched string line.

Hi Experts, Help needed on joining one line above & below to the pattern matched string line. The input file, required output is mentioned below Input file ABCD DEFG5 42.0.1-63.38.31 KKKK iokl IP Connection Available ABCD DEFG5 42.0.1-63.38.31 ... (7 Replies)
Discussion started by: krao
7 Replies

6. Shell Programming and Scripting

[Solved] Finding the next line when a pattern matches

Hi I have a file like this Record 182: Rejected No Data found Record 196: Rejected File Not Found Record 202: Rejected Invalid argument Record 212: Rejected Bad data My requirement is to search for the value "Record" and if found, then return the next line of it. So,... (3 Replies)
Discussion started by: mr_manii
3 Replies

7. Shell Programming and Scripting

[Shell/Perl(?)] Prepending timestamps to console output & writing results to a file

I do a lot of TSM work and I embarked on what I thought would be an easy task, and I'd be very happy for any input to save the pounding my keyboard is receiving :] By default, the output of TSM's console has no timestamping, making it hard to sort through accurately. This puts my console into... (5 Replies)
Discussion started by: Vryali
5 Replies

8. Shell Programming and Scripting

Sed script for appending & prepending

Hello Mates I am trying to write a script, which appends and prepends the text in a file. I tried testing with a small file and it worked fine. but for the large file, the script is wiping the entire file and adds only the word to be appended in the file. mv $file_name $file_name.bak sed... (6 Replies)
Discussion started by: sathyaac
6 Replies

9. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

10. Shell Programming and Scripting

Finding pattern in a text file and returning a part of the word

Dear All, assume that we have a text file or a folder of files, I want to find this pattern followers*.csv in the text file , and get * as the output. There are different matches and * means every character. Thank you in advance. Best, David (1 Reply)
Discussion started by: davidfreed
1 Replies
CREATE TEXT SEARCH 
PARSER(7) SQL Commands CREATE TEXT SEARCH PARSER(7) NAME
CREATE TEXT SEARCH PARSER - define a new text search parser SYNOPSIS
CREATE TEXT SEARCH PARSER name ( START = start_function , GETTOKEN = gettoken_function , END = end_function , LEXTYPES = lextypes_function [, HEADLINE = headline_function ] ) DESCRIPTION
CREATE TEXT SEARCH PARSER creates a new text search parser. A text search parser defines a method for splitting a text string into tokens and assigning types (categories) to the tokens. A parser is not particularly useful by itself, but must be bound into a text search con- figuration along with some text search dictionaries to be used for searching. If a schema name is given then the text search parser is created in the specified schema. Otherwise it is created in the current schema. You must be a superuser to use CREATE TEXT SEARCH PARSER. (This restriction is made because an erroneous text search parser definition could confuse or even crash the server.) Refer to in the documentation for further information. PARAMETERS
name The name of the text search parser to be created. The name can be schema-qualified. start_function The name of the start function for the parser. gettoken_function The name of the get-next-token function for the parser. end_function The name of the end function for the parser. lextypes_function The name of the lextypes function for the parser (a function that returns information about the set of token types it produces). headline_function The name of the headline function for the parser (a function that summarizes a set of tokens). The function names can be schema-qualified if necessary. Argument types are not given, since the argument list for each type of function is predetermined. All except the headline function are required. The arguments can appear in any order, not only the one shown above. COMPATIBILITY
There is no CREATE TEXT SEARCH PARSER statement in the SQL standard. SEE ALSO
ALTER TEXT SEARCH PARSER [alter_text_search_parser(7)], DROP TEXT SEARCH PARSER [drop_text_search_parser(7)] SQL - Language Statements 2010-05-14 CREATE TEXT SEARCH PARSER(7)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy