Hi, I've been searching in this forum for the last 4 hours trying to do one thing: search 2 lines and delete the above line. So far I have not be able to find something similar in this forum, so I need help. This is what I'm trying to do. For example, I have a file called file1:
file1
word1... (4 Replies)
I have a file like this..
Maharastra Mumbai worli
Maharastra Mumbai navy
maharatra Pune
Maharastra Nagpur
Karnataka Bangalore
Karnataka Mysore
Karnataka Mangalore
Punjab Amritsar
punjab Jalandar
my expected outcome should be like this
Maharastra Mumbai worli
---------- ... (9 Replies)
I have my input sometyhing like this
aaa
bbbbbb cccccc
ddddd eeeee
1234 ravi kumar
aaaaaa vvvvvvv
5678 ravi kumar
rrrrrrr mmmmmmm
I want the output as follows.
aaa
bbbbbb cccccc
ddddd eeeee
1234 ravi kumar
aaaaaa vvvvvvv
5678 ravi kumar (2 Replies)
I have my data something like this. I want to delete all the lines before the frist instance of the key word 'ravi kumar'
aaa
bbbbbb cccccc
ddddd eeeee
1234 ravi kumar
aaaaaa vvvvvvv
5678 ravi kumar
rrrrrrr mmmmmmm
I want the output as follows.
1234 ravi kumar
aaaaaa... (8 Replies)
Hi all,
I am looking for a coomand to search for the keywords in susequenct lines. Keyword1 in a line and Keyword2 in the very next line.
Once i found the combination ineed to print the lines with patterns and the line above and one below.
I am giving an example here: Keywords are :ERROR and... (12 Replies)
Hi Geeks :b:,
I need to delete a line from file that contains a particular keyword.
I had read in some forum of unix.com that below code could be used
sed "/$titlesearch/d" movielist >tmp
mv tmp movielist
But my file contains lines which contain slashes (/)
FOr eg:
/etc/movie/title/... (5 Replies)
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
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)
Hi,
I have a requirement like, I have a list of pattens in a file say pattern.txt,
PHC111
PHC113
and in another file called master.lst i have entries like,
PHC111
a
b
PHC112
a
PHC113
b
c
PHC114
d
e (5 Replies)
Hi
I want to implement something like this:
if( keyword1 exists)
then
check if(keyword2 exists in the same line)
then replace keyword 2 with New_Keyword
else
Add New_Keyword at the end of line
end if
eg:
Check for Keyword JUNGLE and add/replace... (7 Replies)
Discussion started by: dashing201
7 Replies
LEARN ABOUT V7
ptx
PTX(1) General Commands Manual PTX(1)NAME
ptx - permuted index
SYNOPSIS
ptx [ option ] ... [ input [ output ] ]
DESCRIPTION
Ptx generates a permuted index to file input on file output (standard input and output default). It has three phases: the first does the
permutation, generating one line for each keyword in an input line. The keyword is rotated to the front. The permuted file is then
sorted. Finally, the sorted lines are rotated so the keyword comes at the middle of the page. Ptx produces output in the form:
.xx "tail" "before keyword" "keyword and after" "head"
where .xx may be an nroff or troff(1) macro for user-defined formatting. The before keyword and keyword and after fields incorporate as
much of the line as will fit around the keyword when it is printed at the middle of the page. Tail and head, at least one of which is an
empty string "", are wrapped-around pieces small enough to fit in the unused space at the opposite end of the line. When original text
must be discarded, `/' marks the spot.
The following options can be applied:
-f Fold upper and lower case letters for sorting.
-t Prepare the output for the phototypesetter; the default line length is 100 characters.
-w n Use the next argument, n, as the width of the output line. The default line length is 72 characters.
-g n Use the next argument, n, as the number of characters to allow for each gap among the four parts of the line as finally printed.
The default gap is 3 characters.
-o only
Use as keywords only the words given in the only file.
-i ignore
Do not use as keywords any words given in the ignore file. If the -i and -o options are missing, use /usr/lib/eign as the ignore
file.
-b break
Use the characters in the break file to separate words. In any case, tab, newline, and space characters are always used as break
characters.
-r Take any leading nonblank characters of each input line to be a reference identifier (as to a page or chapter) separate from the
text of the line. Attach that identifier as a 5th field on each output line.
The index for this manual was generated using ptx.
FILES
/bin/sort
/usr/lib/eign
BUGS
Line length counts do not account for overstriking or proportional spacing.
PTX(1)