Sponsored Content
Top Forums Shell Programming and Scripting How do I search first&second string & copy all content between them to other file? Post 302259143 by pankajp on Monday 17th of November 2008 10:57:43 AM
Old 11-17-2008
How do I search first&second string & copy all content between them to other file?

Hi All,

How do I search first string & second string and copy all content between them from one file to another file?

Please help me..

Thanks In Advance.

Regards,
Pankaj
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

String Search & Replace

Hey, I want to have a C program which, for an existing file supplied by the command line argument (E.g. File1.txt) replaces all the occurrences of the words: "We” or “we” by “I” “a” by “the” “A” by “The”. Then print the replaced file. All other characters of the file are to be left... (1 Reply)
Discussion started by: IwishIknewC
1 Replies

2. Shell Programming and Scripting

how to insert line break + string in vi (search & replace )

Hello all i have big test file that has allot of structure text something like this : <foo1 *.html> <blah action> somthing 1 somthing 2 </blah> </foo1 > now i will like to insert 2 more lines of text below the <blah action> so it will be like : <foo1... (1 Reply)
Discussion started by: umen
1 Replies

3. UNIX for Dummies Questions & Answers

vi search & replace ... having '/' in string - problem.

I want to carry out search & replace for the paths mentioned in the file with the help of vi. 'abc/' to be replaced by 'abc/data' When I use command in vi as below - %s/abc//abc/data/g it gives me an error. How we should deal with '/' part in string for vi search & replace? ... (6 Replies)
Discussion started by: videsh77
6 Replies

4. Shell Programming and Scripting

Search for strings & copy to new file

Hi All, I am just learning shell programming, I need to do the following in my shell script. Search a given log file for two\more strings. If the the two\more strings are found then write it to a outputfile else if only one of the string is found, write the found string in one output... (2 Replies)
Discussion started by: amitrajvarma
2 Replies

5. UNIX for Dummies Questions & Answers

Search for & edit rows & columns in data file and pipe

Dear unix gurus, I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this: adam peter blah blah blah blah blah blah car 01 30 200 02 31 400 03 57 121 .. .. .. .. .. .. n y... (8 Replies)
Discussion started by: tintin72
8 Replies

6. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

7. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

8. Shell Programming and Scripting

NULL Search String & File Name

Hi All, I am writting a Sell Script, that takes Search String & File Name from the terminal and check for Null Status. If either is NULL then pgm should quit. I wrote the following: bash-3.2$ cat null_status_of_parameters.sh #!/bin/sh #WASS that takes Search String & File Name from... (2 Replies)
Discussion started by: manishdivs
2 Replies

9. Shell Programming and Scripting

Search & replace content using awk/gsub

Hi, I have two files master.txt & reference.txt. Sample below Master.txt 2372,MTS,AP 919848001104,Airtel,DL 0819,MTS,MUM 919849788001,Airtel,AP 1430,Aircel MP,20 Reference.txt 2372,919848701430,46467 919848002372,2372,47195 2372,919849788001,59027 0819,028803,1 0819,029801,1... (2 Replies)
Discussion started by: siramitsharma
2 Replies

10. Shell Programming and Scripting

Search & Replace content of files using gsub in awk

Hi,I have 2 files master.txt & reference.txt as shown below & i require o/p as mentioned in file 3 using awk but content is not replacing properlymaster.txt:... (15 Replies)
Discussion started by: siramitsharma
15 Replies
PG(1)								   User Commands							     PG(1)

NAME
pg - browse pagewise through text files SYNOPSIS
pg [-number] [-p string] [-cefnrs] [+line] [+/pattern/] [file...] DESCRIPTION
Pg displays a text file on a CRT one screenful at once. After each page, a prompt is displayed. The user may then either press the newline key to view the next page or one of the keys described below. If no filename is given on the command line, pg reads from standard input. If the standard output is not a terminal, pg acts like cat(1) but precedes each file with its name if there is more than one. If input comes from a pipe, pg stores the data in a buffer file while reading to make navigation possible. OPTIONS
Pg accepts the following options: -number The number of lines per page. Usually, this is the number of CRT lines minus one. -c Clear the screen before a page is displayed if the terminfo entry for the terminal provides this capability. -e pg will not pause and display (EOF) at the end of a file. -f pg does not split long lines. -n Without this option, commands must be terminated by a newline character. With this option, pg advances once a command letter is entered. -p string Instead of the prompt : , string is displayed. If string contains %d , its first occurrence is replaced by the number of the cur- rent page. -r Disallow the shell escape. -s Print messages in standout mode if the terminfo entry for the terminal provides this capability. +number Start at the given line. +/pattern/ Start at the line containing the Basic Regular Expression pattern given. USAGE
The following commands may be entered at the prompt. Commands preceded by i in this document accept a number as argument, positive or nega- tive. If this argument starts with + or -, it is interpreted relative to the current position in the input file, otherwise relative to the beginning. i<newline> Display the next or the indicated page. id or ^D Display the next halfpage. If i is given, it is always interpreted relative to the current position. il Display the next or the indicated line. if Skip a page forward. i must be a positive number and is always interpreted relative to the current position. iw or iz Behave as <newline> except that i becomes the new page size. . or ^L Redraw the screen. $ Advance to the last line of the input file. i/pattern/ Search forward until the first or the i-th occurrence of the Basic Regular Expression pattern is found. The search starts after the current page and stops at the end of the file. No wrap-around is performed. i must be a positive number. i?pattern? or i^pattern^ Search backward until the first or the i-th occurrence of the Basic Regular Expression pattern is found. The search starts before the current page and stops at the beginning of the file. No wrap-around is performed. i must be a positive number. The search commands accept an added letter. If t is given, the line containing the pattern is displayed at the top of the screen, which is the default. m selects the middle and b the bottom of the screen. The selected position is used in following searches, too. in Advance to the next file or i files forward. ip Reread the previous file or i files backward. s filename Save the current file to the given filename. h Display a command summary. !command Execute command using the shell. q or Q Quit. If the user presses the interrupt or quit key while pg reads from the input file or writes on the terminal, pg will immediately display the prompt. In all other situations these keys will terminate pg. ENVIRONMENT VARIABLES
The following environment variables affect the behaviour of pg: COLUMNS Overrides the system-supplied number of columns if set. LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES See locale(7). LINES Overrides the system-supplied number of lines if set. SHELL Used by the ! command. TERM Determines the terminal type. SEE ALSO
cat(1), more(1), sh(1), terminfo(5), locale(7), regex(7), term(7) NOTES
pg expects the terminal tabulators to set on eight positions. Files that include NUL characters cannot be displayed by pg. AVAILABILITY
The pg command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. Gunnar Ritter 2001-04-25 PG(1)
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy