Sponsored Content
Top Forums Shell Programming and Scripting replacing 1e+ with powers of ten Post 302596133 by pau on Monday 6th of February 2012 04:00:33 PM
Old 02-06-2012
replacing 1e+ with powers of ten

Dear all,

I am trying to write a script that modifies a file created with gnuplot.

If (the "if" is important, some files might not have them) in the (tex) file there are instances like


Code:
      \put(1342,704){\makebox(0,0)[r]{\strut{} 1e+31}}%
      \csname LTb\endcsname%
      \put(1342,1383){\makebox(0,0)[r]{\strut{} 1e+32}}%
      \csname LTb\endcsname%
      \put(1342,2061){\makebox(0,0)[r]{\strut{} 1e+33}}%
      \csname LTb\endcsname%
      \put(1342,2740){\makebox(0,0)[r]{\strut{} 1e+34}}%
      \csname LTb\endcsname%
      \put(1342,3418){\makebox(0,0)[r]{\strut{} 1e+35}}%
      \csname LTb\endcsname%
      \put(1342,4097){\makebox(0,0)[r]{\strut{} 1e+36}}%
      \csname LTb\endcsname%
      \put(1342,4775){\makebox(0,0)[r]{\strut{} 1e+37}}%
      \csname LTb\endcsname%
      \put(1474,484){\makebox(0,0){\strut{} 1e-08}}%
      \csname LTb\endcsname%
      \put(2073,484){\makebox(0,0){\strut{} 1e-07}}%
      \csname LTb\endcsname%
      \put(2673,484){\makebox(0,0){\strut{} 1e-06}}%
      \csname LTb\endcsname%
      \put(3272,484){\makebox(0,0){\strut{} 1e-05}}%
      \csname LTb\endcsname%
      \put(3872,484){\makebox(0,0){\strut{} 0.0001}}%
      \csname LTb\endcsname%
      \put(4471,484){\makebox(0,0){\strut{} 0.001}}%
      \csname LTb\endcsname%
      \put(5071,484){\makebox(0,0){\strut{} 0.01}}%
      \csname LTb\endcsname%
      \put(5670,484){\makebox(0,0){\strut{} 0.1}}%
      \csname LTb\endcsname%
      \put(6270,484){\makebox(0,0){\strut{} 1}}%

then replace them with

Code:
      \put(1342,704){\makebox(0,0)[r]{\strut{} $10^{31}$}}%
      \csname LTb\endcsname%
      \put(1342,1383){\makebox(0,0)[r]{\strut{} $10^{32}$}}%
      \csname LTb\endcsname%
      \put(1342,2061){\makebox(0,0)[r]{\strut{} $10^{33}$}}%
      \csname LTb\endcsname%
      \put(1342,2740){\makebox(0,0)[r]{\strut{} $10^{34}$}}%
      \csname LTb\endcsname%
      \put(1342,3418){\makebox(0,0)[r]{\strut{} $10^{35}$}}%
      \csname LTb\endcsname%
      \put(1342,4097){\makebox(0,0)[r]{\strut{} $10^{36}$}}%
      \csname LTb\endcsname%
      \put(1342,4775){\makebox(0,0)[r]{\strut{} $10^{37}$}}%
      \csname LTb\endcsname%
      \put(1474,484){\makebox(0,0){\strut{} $10^{-08}$}}%
      \csname LTb\endcsname%
      \put(2073,484){\makebox(0,0){\strut{} $10^{-07}$}}%
      \csname LTb\endcsname%
      \put(2673,484){\makebox(0,0){\strut{} $10^{-06}$}}%
      \csname LTb\endcsname%
      \put(3272,484){\makebox(0,0){\strut{} $10^{-05}$}}%
      \csname LTb\endcsname%
      \put(3872,484){\makebox(0,0){\strut{} 0.0001}}%
      \csname LTb\endcsname%
      \put(4471,484){\makebox(0,0){\strut{} 0.001}}%
      \csname LTb\endcsname%
      \put(5071,484){\makebox(0,0){\strut{} 0.01}}%
      \csname LTb\endcsname%
      \put(5670,484){\makebox(0,0){\strut{} 0.1}}%
      \csname LTb\endcsname%
      \put(6270,484){\makebox(0,0){\strut{} 1}}%



i.e.

all e in a line preceded by \strut{} ---> replace with 0

all + in a line preceded by \strut{} ---> replace with ^{ and close bracket

all - in a line preceded by \strut{} ---> add before ^{ and close bracket

and then wrap all instances of 10^{whatever} with dollars ---> $10^{whatever}$


Thanks....
 

6 More Discussions You Might Find Interesting

1. Solaris

Will I lose drivers while upgrading to ten?

I'm running Solaris 8 with a box I just got and it has a VGA connection. Will I lose the VGA driver while upgrading to 10? I don't have a Sun Monitor so if so I'll be screwed. Tia (0 Replies)
Discussion started by: PapaPark
0 Replies

2. UNIX for Dummies Questions & Answers

Removing last ten characters from a column

I have a file that looks like this: hsa-miR-517b-4373244 0 4.116 hsa-miR-886-5p-4395304 1.173 1.95 hsa-miR-551b-4380945 1.62 1.722 hsa-miR-886-3p-4395305 1.479 3.074 hsa-miR-125a-3p-4395310 1.246 2.697 hsa-miR-874-4395379 1.985 1.721 I want it too look like this: ... (9 Replies)
Discussion started by: e3r1ck_ETT
9 Replies

3. Shell Programming and Scripting

Display top ten directories by size

Hi, I am new to Unix. I want to display top 10 folders by size. I tried with du -ksl * | sort -nr | head -10 command .But I am getting the following error -bash: /usr/bin/du: Argument list too long Can some one help me. Thanks. (5 Replies)
Discussion started by: Satyak
5 Replies

4. Shell Programming and Scripting

Retry every ten seconds while lockfile present

Hi, I have written below check lockfile script but need some tweaking on it. If there is a lockfile from present, I need the script to retry every 10 seconds to see if the lockfile is still there. After 120 seconds it should send an email. In my current version, if the script encounters... (6 Replies)
Discussion started by: Meert
6 Replies

5. Shell Programming and Scripting

execute the shell script per ten seconds

hi, everyone. My want to execute the shell script below per 10 seconds PID=`pgrep java` if then /home/java/java fi crontab wouldn't help me. some one can give me suggestions?thanks ---------- Post updated at 07:29 AM ---------- Previous update was at 07:26 AM ---------- ... (6 Replies)
Discussion started by: AKB48
6 Replies

6. Shell Programming and Scripting

Sequential numbering from 1 to ten

Hi I am in a bind, I need create a script that will rename files as they come into a folder with sequential numbering at the begining starting at 1 and proceeding to ten then starting at 1 again. Such as 1_filename.pdf, 2_filename.pdf, 3_filename.pdf, 4_filename.pdf, 5_filename.pdf, 6_filename.pdf,... (6 Replies)
Discussion started by: Paul Walker
6 Replies
putnext(9F)						   Kernel Functions for Drivers 					       putnext(9F)

NAME
putnext - send a message to the next queue SYNOPSIS
#include <sys/stream.h> #include <sys/ddi.h> void putnext(queue_t *q, mblk_t *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
q Pointer to the queue from which the message mp will be sent. mp Message to be passed. DESCRIPTION
putnext() is used to pass a message to the put(9E) routine of the next queue in the stream. RETURN VALUES
None. CONTEXT
putnext() can be called from user or interrupt context. EXAMPLES
See allocb(9F) for an example of using putnext(). SEE ALSO
put(9E), allocb(9F), put(9F), qprocson(9F) Writing Device Drivers STREAMS Programming Guide NOTES
The put() and putnext() functions should be called only after qprocson() is finished. SunOS 5.10 18 Feb 1998 putnext(9F)
All times are GMT -4. The time now is 05:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy