$2==9030 is quite precise, compared to /9030/ where 9030 can appear as string or substring in all columns.
Back to the while loop. The read command can split the columns into variables
Sometimes it makes sense to use a case-esac.
The $(( )) can contain a modification of the variable.
BTW here, like in your final awk solution, the $i is not incremented if there is no 1930
(Comment for the experts: bash-2 and ksh88 need i+=1 rather than ++i)
This User Gave Thanks to MadeInGermany For This Post:
Hi all,
I have a very large; delimited file. In vi I would like to replace:
CSACT_DY;AVG_UEACT1;uesPerActiveLinkSetSize_1;#;A
CSACT_DY;AVG_UEACT2;uesPerActiveLinkSetSize_2;#;A
CSACT_DY;AVG_UEACT3;uesPerActiveLinkSetSize_3;#;A
with:
CSACT_DY;AVG_UEACT1;Average... (7 Replies)
HPUX /bin/sh (posix)
I have a file as such
cat dog mouse
deer elk rabbit
mouse rat pig
I would like to replace the second occurrence of mouse in this file with mouse2. The rest of the file has to stay exactly as is. I'm not sure exactly where mouse might be (could be first,second,third... (5 Replies)
hi all,
I have a text file with following content
PAGENUMBER
asasasa
asasasa
PAGENUMBER
sasasasasa
PAGENUMBER
using sed i want to replace PAGENUMBER by occurrence count
eg
1
asasasa
asasasa
2
sasasasasa
3 (4 Replies)
Hello Folks..
I need your help ..
here the example of my problem..i know its easy..i don't all the commands in unix to do this especiallly sed...here my string..
dwc2_dfg_ajja_dfhhj_vw_dec2_dfgh_dwq
desired output is..
dwc2_dfg_ajja_dfhhj
it's a simple task with tail... (5 Replies)
Ok,
So I have a huge file that has over 12000 lines in it.
in this file, there are 589 occurrences of the string "use five-minute-interval" spread in various areas in the file.
How can i replace the the last 250 of the occurrences of "use five-minute-interval" with "use... (10 Replies)
I couldn't find the answer anywhere, so I hope you could help me.
I need to change something like the following:
something/bla/aaaa
anything/bbb
to:
something
--bla
----aaaa
anything
--bbb
How do I do this?
Is it possible with sed?
I tried various patterns, but don't know how to... (5 Replies)
Hi,
Hi,
I have a file with following format
1|" "text " around " |" fire "guest"|" "
2| "xyz"" | "no guest"|"3"
3| """ test3""| "one" guest"|"4"
My requirement is to replace all occurrences of " to ' which are occurring between |" "|delimiter
so my output should look like this
1|"... (3 Replies)
hey guys, i have been trying to work this thing out with sed with no luck :confused:
i m looking for a way to replace only the first occurrence after a match
for example :
Cat
Realized what you gotta do
Dog
Realized what you gotta do
Sheep
Realized what you gotta do
Wolf
Realized... (6 Replies)
Hi All,
I have a requirement to replace consecutive occurence of same string nedd to be replaced. Below is the input and desired output.
Input:
---------
123.5|ABC|.|.|.
234.4|DEF|.|.|.|.|.|
Output:
---------
123.5|ABC|||.
234.4|DEF|||||
so basically "|.|" need to be replaced with... (9 Replies)
Hello,
Below command trims right after the nth occurrence of a string.
When I try in while loop, it is not working.
In Terminal
IFS=/ ; read -ra val < Textfile ; echo "${val:0:3}"
It gives only one line:
sunday/monday/tuesday
Textfile:
sunday/monday/tuesday/wednesday/thursday... (2 Replies)
Discussion started by: baris35
2 Replies
LEARN ABOUT DEBIAN
latex::encode
LaTeX::Encode(3pm) User Contributed Perl Documentation LaTeX::Encode(3pm)NAME
LaTeX::Encode - encode characters for LaTeX formatting
SYNOPSIS
use LaTeX::Encode;
$latex = latex_encode($text, %options);
VERSION
This manual page describes version 0.03 of the "LaTeX::Encode" module.
DESCRIPTION
This module provides a function to encode text that is to be formatted with LaTeX. It encodes characters that are special to LaTeX or that
are represented in LaTeX by LaTeX commands.
The special characters are: "" (command character), "{" (open group), "}" (end group), "&" (table column separator), "#" (parameter
specifier), "%" (comment character), "_" (subscript), "^" (superscript), "~" (non-breakable space), "$" (mathematics mode).
Note that some of the LaTeX commands for characters are defined in the LaTeX "textcomp" package. If your text includes such characters,
you will need to include the following lines in the preamble to your LaTeX document.
usepackage[T1]{fontenc}
usepackage{textcomp}
The function is useful for encoding data that is interpolated into LaTeX document templates, say with "Template::Plugin::Latex" (shameless
plug!).
SUBROUTINES /METHODS
"latex_encode($text, %options)"
Encodes the specified text such that it is suitable for processing with LaTeX. The behaviour of the filter is modified by the options:
"except"
Lists the characters that should be excluded from encoding. By default no special characters are excluded, but it may be useful to
specify "except = "\{}"" to allow the input string to contain LaTeX commands such as "this is \textbf{bold} text" (the doubled
backslashes in the strings represent Perl escapes, and will be evaluated to single backslashes).
"iquotes"
If true then single or double quotes around words will be changed to LaTeX single or double quotes; double quotes around a phrase
will be converted to "``" and "''" and single quotes to "`" and "'". This is sometimes called "intelligent quotes"
"use_textcomp"
By default the "latex_encode" filter will encode characters with the encodings provided by the "textcomp" LaTeX package (for
example the Pounds Sterling symbol is encoded as "\textsterling{}"). Setting "use_textcomp = 0" turns off these encodings. NOT
YET IMPLEMENTED
EXAMPLES
The following snippet shows how data from a database can be encoded and inserted into a LaTeX table, the source of which is generated with
"LaTeX::Table".
my $sth = $dbh->prepare('select col1, col2, col3 from table where $expr');
$sth->execute;
while (my $href = $sth->fetchrow_hashref) {
my @row;
foreach my $col (qw(col1 col2 col3)) {
push(@row, latex_encode($href->{$col}));
}
push @data, @row;
}
my $headings = [ [ 'Col1', 'Col2', 'Col3' ] ];
my $table = LaTeX::Table->new( { caption => 'My caption',
label => 'table:caption',
type => 'xtab',
header => $header,
data => @data } );
my $table_text = $table->generate_string;
Now $table_text can be interpolated into a LaTeX document template.
DIAGNOSTICS
None. You could probably break the "latex_encode" function by passing it an array reference as the options, but there are no checks for
that.
CONFIGURATION AND ENVIRONMENT
Not applicable.
DEPENDENCIES
The "HTML::Entities" and "Pod::LaTeX" modules were used for building the encoding table in "LaTeX::Encode::EncodingTable", but this is not
rebuilt at installation time. The "LaTeX::Driver" module is used for formatting the character encodings reference document.
INCOMPATIBILITIES
None known.
BUGS AND LIMITATIONS
Not all LaTeX special characters are included in the encoding tables (more may be added when I track down the definitions).
The "use_textcomp" option is not implemented.
AUTHOR
Andrew Ford <a.ford@ford-mason.co.uk>
LICENSE AND COPYRIGHT
Copyright (C) 2007 Andrew Ford. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
Template::Plugin::Latex
perl v5.10.0 2007-10-02 LaTeX::Encode(3pm)