Sponsored Content
Top Forums Shell Programming and Scripting Replacing all occurences depending on parity Post 302364908 by Scott on Saturday 24th of October 2009 02:16:43 PM
Old 10-24-2009
Code:
awk -F'$' -v OFS="$" '{$2="latex " $2; $4="latex " $4} 1' file1  
Solve the equation $latex x^2=5$. Prove that $latex x$ is an irrational number.

If you have more than 4 $'s you can always do this in a for-loop:

Code:
awk -F'$' -v OFS='$' '{ for( I = 2; I <= NF; I+=2 )
  $I = "latex " $I
} 1' file1

Solve the equation $latex x^2=5$. Prove that $latex x$ is an irrational number.


Last edited by Scott; 10-24-2009 at 03:34 PM.. Reason: added for loop
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting number of occurences

Hi All, I have to count the number of occurences of the character " ; " in a given line. I had used the following awk command to achieve the same echo $KOP.dat|awk '{split($1,my,";"); for(i in my)c++ }END{print c-1}' My file KOP.dat had the following data ... (1 Reply)
Discussion started by: kingofprussia
1 Replies

2. Shell Programming and Scripting

occurences of words

I have a string like this. $str="The astrocyte profile might contribute to the identification of possible therapies in profiles profiling and profiled als."; Lets consider for example: a)If user enters the term profile* it should highlight profile,profiles only. b)If user enters the... (3 Replies)
Discussion started by: vanitham
3 Replies

3. Shell Programming and Scripting

no of occurences of q word

hi I hace a string "abc,def,ghi,abc,def ,ghi,abc,def,ghi,abc,def ,ghi,abc" i replaced commas with spaces, now i want to calculate nof occurences of "abc" word. thanks in advance Satya (6 Replies)
Discussion started by: Satyak
6 Replies

4. Linux

kernel: Additional sense: Scsi parity error ()

Hey guys how do you troubleshoot this kind of problem kernel: Additional sense: Scsi parity error () (2 Replies)
Discussion started by: sbn
2 Replies

5. Shell Programming and Scripting

Perl - Count occurences

I have enclosed the script. I am able to find the files that contain my search string but when I try to count the occurences within the file I get zero always. Any help on this. #!/usr/bin/perl my $find = $ARGV; my $replace = $ARGV; my $glob = $ARGV; @filelist = <*$glob>; # process each... (22 Replies)
Discussion started by: TimHortons
22 Replies

6. UNIX for Dummies Questions & Answers

Parity, SRM, VSA/Fusion, Service Portal, Remotely Anywhere, and Tivoli TEC.

Can some one explain or send me the links about these tools Parity, SRM, VSA/Fusion, Service Portal, Remotely Anywhere, and Tivoli TEC. (2 Replies)
Discussion started by: rags
2 Replies

7. Shell Programming and Scripting

Awk to count occurences

Hi, i am in need of an awk script to accomplish the following: Input table looks like: Student1 arts Student2 science Student3 arts Student4 science Student5 science Student6 science Student7 science Student8 science Student9 science Student10 science Student11 science... (8 Replies)
Discussion started by: saint2006
8 Replies

8. Solaris

solaris raids parity

what actually stored in the parity reserved on each slice in raid 5 configuration. how to restore the data if a disk is failed in raid5 configuration (1 Reply)
Discussion started by: revathireddy
1 Replies

9. Shell Programming and Scripting

Order as per top occurences

Hi I have a file with entries like below top 5 a 5 b 4 c 3 d 2 e 1 top 5 b 5 d 4 c 3 e 2 a 1 top 5 e 5 d 4 c 3 b 2 a 1 (2 Replies)
Discussion started by: Viswanatheee55
2 Replies
KLATEXFORMULA(1)					      General Commands Manual						  KLATEXFORMULA(1)

NAME
klatexformula -- Gui to generate pictures from latex formulas. SYNOPSIS
klatexformula [-i,--input file] [-l,--latexinput expression ] [-o,--output file ] [-F,--format format] [-f,--fgcolor '#xxxxxx'] [-b,--bgcolor '#xxxxxx'] [-X,--dpi N] [-m,--mathmode expression containing '...'] [-p,--preamble LaTeX code] [-q,--quiet] [--lbor- deroffset N] [--tborderoffset N] [--rborderoffset N] [--bborderoffset N] [--tempdir /path/to/temp/dir] [--latex latex executable] [--dvips dvips executable] [--gs gs executable] [--epstopdf epstopdf executable] [-h,--help] [-V,--version] [-Q,--qtoption qt-option] DESCRIPTION
This manual page documents briefly the klatexformula program. klatexformula provides a GUI to easily get an image from a LaTeX formula or equation. It can alos be used via commandline using the options below. OPTIONS
-i,--input file Specifies a file to read latex input from. -l,--latexinput expression Specifies the LaTeX code of an equation to render. -o,--output file Specifies to write the output image (obtained from equation given by --input or --latexinput) to file or standard output. -F,--format format Specifies the format the output should be written in. By default, the format is guessed from file name extension and defaults to PNG. -f,--fgcolor '#xxxxxx' Specifies a color (in web #RRGGBB hex format) to use for foreground color. Don't forget to escape the '#' to prevent the shell from interpreting it as a comment. -b,--bgcolor '#xxxxxx' Specifies a color (in web #RRGGBB hex format, or '-' for transparent) to use as background color (defaults to transparent). -X,--dpi N Use N dots per inch (DPI) when converting latex output to image. Defaults to 1200 (high-resolution image). -m,--mathmode expression containing '...' Specifies which LaTeX math mode to use, if any. The termument to this option is any string containing "...", which will be replaced by the equation itself. Defaults to "[ ... ]" -p,--preamble LaTeX code Any LaTeX code that will be inserted before egin{document}. Useful for including custom packages with usepackage{...}. -q,--quiet Disable console output of warnings and errors. --lborderoffset N,--tborderoffset N,--rborderoffset N,--bborderoffset N Include a mtermin of N postscript points on left, top, right, or bottom mtermin respectively. --tempdir /path/to/temp/dir Specify the directory in which KLatexFormula will write temporary files. Defaults to a system-specific temporary directory like "/tmp/". --latex latex executable --dvips dvips executable --gs gs executable --epstopdf epstopdf executable Specifiy the executable for latex, dvips, gs or epstopdf. By default, they are searched for in $PATH and/or in common system directories. -h,--help Display this help text and exit. -V,--version Display KLatexFormula version information and exit. -Q,--qtoption qt-option Specify a Qt-Specific option. For example, to launch KLatexFormula in Plastique GUI style, use: klatexformula --qtop- tion='-style=Plastique' Note that if qt-option begins with a '-', then it must be appended to the long '--qtoption=' syntax with the equal sign. SEE ALSO
latex (1), ghostview (1), http://klatexformula.sourceforge.net/ AUTHOR
This manual page was written by Tobias Winchen tobias.winchen@physik.rwth-aachen.de for the Debian system (and may be used by others) based on the upstream documentation by Phillipe Faist. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. KLATEXFORMULA(1)
All times are GMT -4. The time now is 10:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy