I've been working on this all night and finally have to ask for help... and not just from my coffee pot.
I need to replace a line of text only when it is proceeded by a line containing only the letter "H"
Input:
Desired Output:
I've tried many variations of perl and sed code that I have found here and elsewhere. As a result I've managed to do the opposite of what I wanted or to make a global substitution in dozens of different ways, but never have I managed the desired substitution.
My most recent attempts have been of this general nature:
I'm open to any options and am only using perl because it's what I'm most familiar with.
While the find and replace expressions I've been using for the above example may be incorrect I know that there is also an issue with the substitution code because I have used it on a simplified example containing only friendly characters and have encountered the same issues.
Last edited by EmperorNorton; 05-04-2008 at 12:48 PM..
Reason: no longer a perl question
Hi,
Can anyone know how to use perl to merge the following multi-line information which beginning with "BAM" into one line. For each line need to delete the return and add a space. Please see the red color line.
******Org. Multi-line)
BAM admin 101.203.57.22 ... (3 Replies)
Hello,
Did anyone know how to write a perl script to merge the multi-line into a single line where each line with start at timestamp
Input-->
timestamp=2009-11-10-04.55.20.829347;
a;
b;
c;
timestamp=2009-11-10-04.55.20.829347;
aa;
bb;
cc; (5 Replies)
hello mighty all
there's a file with lots of comments.. some of them looks like:
=comment
blabla
blablabla
bla
=cut
i'm trying to cut this out completely with this code:
$line=~s/^=.+?=cut//sg;
but no luck
also tryed to change it abit but still I don't understand how the... (9 Replies)
Hello
I did do a search and the past threads doesn't really solve my issue. (using various awk commands)
I need to combine the output from java -version into 1 line, but I am having difficulties.
When you exec java -version, you get:
java version "1.5.0_06"
Java(TM) 2 Runtime... (5 Replies)
Hi,
My Oracle query is returing below o/p
----------------------------------------------------------
Ins trnas value
a lkp1 x
a lkp1 y
b lkp1 a
b lkp2 x
b lkp2 y ... (7 Replies)
I have a file with data records separated by multiple equals signs, as below.
==========
RECORD 1
==========
RECORD 2
DATA LINE
==========
RECORD 3
==========
RECORD 4
DATA LINE
==========
RECORD 5
DATA LINE
==========
I need to filter out all data from this file where the... (2 Replies)
Hi,
With the following Perl syntax, how to print the $_ value after the substitution?
s/(\s*|\n)//g foreach (<>);
If I use the below code, it produces some numeric output print s/(\s*|\n)//g foreach (<>); (2 Replies)
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
I want to read the log file which was generate from other command . And the output was having multi line in log files for job name and server name. But i need to make all the logs on one line
Source file
07/15/2018 17:02:00 TRANSLOG_1700 Server0005_SQL ... (2 Replies)
Discussion started by: ranjancom2000
2 Replies
LEARN ABOUT DEBIAN
cmap
CMAP(5) File Formats Manual CMAP(5)NAME
cmap - format of .cmap files (color maps)
DESCRIPTION
Color-map files define the mapping between eight-bit color numbers and red, green and blue intensities used for those numbers. They are
read by Magic as part of system startup, and also by the :load and :save commands in color-map windows. Color-map file names usually have
the form x.y.z.cmapn, where x is a class of technology files, y is a class of displays, z is a class of monitors, and n is a version number
(currently 1). The version number will change in the future if the formap of color-map files ever changes. Normally, x and y correspond to
the corresponding parts of a display styles file. For example, the color map file mos.7bit.std.cmap1 is used today for most nMOS and CMOS
technology files using displays that support at least seven bits of color per pixel and standard-phosphor monitors. It corresponds to the
display styles file mos.7bit.dstyle5.
Color-map files are stored in ASCII form, with each line containing four decimal integers separated by white space. The first three inte-
gers are red, green, and blue intensities, and the fourth field is a color number. For current displays the intensities must be integers
between 0 and 255. The color numbers must increase from line to line, and the last line must have a color number of 255. The red, green,
and blue intensities on the first line are used for all colors from 0 up to and including the color number on that line. For other lines,
the intensities on that line are used for all colors starting one color above the color number on the previous line and continuing up and
through the color number on the current line. For example, consider the color map below:
255 0 0 2
0 0 255 3
255 255 255 256
This color map indicates that colors 0, 1, and 2 are to be red, color 3 is to be blue, and all other colors are to be white.
SEE ALSO magic(1), dstyle(5)4th Berkeley DistributionCMAP(5)