02-23-2004
find and copy string in a file
Hello there
I need to find a string in an file, and then copy to a new file from the previous 6 lines to 41 lines after the string.
So, what i need to do , and just don't know how, is to find the string and copy 48 lines where the string would be in the 7th line.
I don't know if i can do it with "sed", but i've readed the man in my hp-ux, and all the threads i could find about manipulating files, and got a lot confused.
Thanks for any help.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to search for files and copy them into a text file. Can anybody help me how to do that.
find /test/sds/data -name "*.*" -mtime -365 -exec ls -altr {} \
this is my find command and want to copy the result to a file. (2 Replies)
Discussion started by: pujars1
2 Replies
2. UNIX for Advanced & Expert Users
I am using the following command to email a tex file as an attachment-
cat mailtext.txt | elm -s "Subject" emailAddr
where content of mailtext.txt is -
"Body of email"
This will attach foo.txt with the email.
My problem is that the file foo.txt is ceated dynamically everytime with a... (5 Replies)
Discussion started by: hpuxlxboy
5 Replies
3. Shell Programming and Scripting
I'm trying to copy a string (myame@yahoo.com) from multiple files and save them to a new file.
This is what's I've gathered so far:
sed 's/string/g' file.txt > output.txt
Not sure how to run this on multiple files and extract just the email address found in each file.
Any help would be... (2 Replies)
Discussion started by: rdell
2 Replies
4. Shell Programming and Scripting
Hi! just want to seek help on this:
i have a file wherein i want to find a string and copy the string after that and paste that other string to a new file.
ex:
TOTAL 123456
find "TOTAL" and copy "123456"
and paste "123456" to a new file
NOTE: there are many "TOTAL" strings on that... (12 Replies)
Discussion started by: kingpeejay
12 Replies
5. Shell Programming and Scripting
i have a file1 with many lines. i have a script that will let me input a string. for example, APPLE. what i need to do is to copy all lines from file1 where i can find APPLE or any string that i specify and paste in on file 2
thanks in advance! (4 Replies)
Discussion started by: engr.jay
4 Replies
6. Linux
Hi all,
I have a question..
Here is my requirement..I have 500 files in a path say /a/b/c
I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies
7. Shell Programming and Scripting
I am new, really new to bash scripts.
I want to search an XML file for a certain string, say "1234567890"
Once found, I want to copy the entire contents from the previous instance of the string "Entity" to the next instance of "/Entity" to a txt file.
And then continue searching for the... (4 Replies)
Discussion started by: jrfiol
4 Replies
8. Shell Programming and Scripting
Hi All,
I am new to shell srcipting.
Problem :
I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
Discussion started by: mail.chiranjit
2 Replies
9. Shell Programming and Scripting
Hello
I would like to get know how to do this:
I got a big file (about 1GB) and I need to find a string (for instance by grep )
and then find all records in this file based on a string.
Thanks for advice.
Martin (12 Replies)
Discussion started by: mape
12 Replies
10. Shell Programming and Scripting
OS version: RHEL 6.7
Shell : Bash
I have a file like below. It has 500K lines.
I want to extract TAG_IDs shown in single quote at the end to copied to another file. As if I had copied the TAG_IDs using block select (Column Select) in modern text editor
$ cat file.txt
UPDATE TAGREF SET... (9 Replies)
Discussion started by: John K
9 Replies
LEARN ABOUT REDHAT
ppmtomitsu
ppmtomitsu(1) General Commands Manual ppmtomitsu(1)
NAME
ppmtomitsu - convert a portable pixmap to a Mitsubishi S340-10 file
SYNOPSIS
ppmtomitsu [-sharpness val] [-enlarge val] [-media string] [-copy val] [-dpi300] [-tiny] [ppmfile]
DESCRIPTION
Reads a portable pixmap as input and converts it into a format suitable to be printed by a Mitsubishi S340-10 printer, or any other Mit-
subishi color sublimation printer.
The Mitsubishi S340-10 Color Sublimation printer supports 24bit color. Images of the available sizes take so long to transfer that there
is a fast method, employing a lookuptable, that ppmtomitsu will use if there is a maximum of 256 colors in the pixmap. ppmtomitsu will try
to position your image to the center of the paper, and will rotate your image for you if xsize is larger than ysize. If your image is
larger than the media allows, ppmtomitsu will quit with an error message. (We decided that the media were too expensive to have careless
users produce misprints.) Once data transmission has started, the job can't be stopped in a sane way without resetting the printer. The
printer understands putting together images in the printers memory; ppmtomitsu doesn't utilize this as pnmcat etc provide the same func-
tionality and let you view the result on-screen, too. The S340-10 is the lowest common denominator printer; for higher resolution printers
there's the dpi300 option. The other printers also support higher values for enlarge eg, but I don't think that's essential enough to war-
rant a change in the program.
-sharpness 1-4
'sharpness' designation. Default is to use the current sharpness.
-enlarge 1-3
Enlarge by a factor; Default is 1 (no enlarge)
-media A, A4, AS, A4S
Designate the media you're using. Default is 1184 x 1350, which will fit on any media. A is 1216 x 1350, A4 is 1184 x 1452, AS is
1216 x 1650 and A4S is 1184 x 1754. A warning: If you specify a different media than the printer currently has, the printer will
wait until you put in the correct media or switch it off.
-copy 1-9
The number of copies to produce. Default is 1.
-dpi300
Double the number of allowed pixels for a S3600-30 Printer in S340-10 compatibility mode. (The S3600-30 has 300 dpi).
-tiny Memory-safing, but always slow. The printer will get the data line-by-line in 24bit. It's probably a good idea to use this if your
machine starts paging a lot without this option.
REFERENCES
Mitsubishi Sublimation Full Color Printer S340-10 Specifications of Parallel Interface LSP-F0232F
SEE ALSO
ppmquant(1), pnmscale(1), ppm(5)
BUGS
We didn't find any - yet. (Besides, they're called features anyway :-) If you should find one, my email-adress is below.
AUTHOR
Copyright (C) 1992, 93 by S.Petra Zeidler, MPIfR Bonn, Germany. (spz@specklec.mpifr-bonn.mpg.de)
29 Jan 1992 ppmtomitsu(1)