search for any number, and retain them in replacement
Hello!
Here is what I am trying to do: I am taking a class at school that is using a lot of literature that is in the public domain, and available for free on the web. Rather than read them online in HTML, I have been pulling them down and quickly and dirtily tagging them up and typesetting them with LaTeX.
I am pulling down a piece of work that has a lot of end notes, and i would like to write a script so that I can add all of the \endnotemarker and \endnotetext tags relatively automatically.
All of the notes are already numbered appropriately, but not tagged.
What I would like to do, with either Perl or SED or AWK or VI or whatever would be best... is search for all integers and then apply the tag before an after it. The problem I am running into, is that my search term is something like
but, obviously, if I use a replace term, it is not going to use the number that was found, but literally whatever I write in the replace term (this is all in VI right now, sorry I was not clear).
This is why I think I need some kind of a script that will find the number, store the number in a variable and then I can call upon that specific variable in the replacement term. The variable would update each time a new integer is found.
I might thinking about this all wrong, but can anyone think of a simple way to do this? It is not life and death, it would just make the file I generate something worth keeping around for re-reading.
Thanks!
EDIT: now that I think about it, I dont think this will really work for the LaTeX operation, but does anyone know how to write a script to do this in general... like if I wanted to add a word after every time a number appears in a paragraph, without changing the number?
I'll play with this, thank you! I guess the part of the command that you taught me was the
I did not know of that function! I'll look it up in the manual... thanks!
Hi,
I am looking for a solution to find files in a folder and subfolders.
Those files should be moved (some with spaces) when they were between 2015 Feb. 03 and 2014 Nov. 24.
find . -type f -newermt "2010-01-01" ! -newermt "2010-06-01"
I am working on a QNAP with a small busybox.... (2 Replies)
Dear Unix Forum Group Members,
Please do let me know how I can replace the double pipe with single pipe recursively on single record.
Sample Input Data:
DN set|Call prefix||| Called number address nature
0||| *789|||||||ALL number types
0||| 00||||||||ALL number types
10||... (5 Replies)
Hi,
I have a task of "encrypting" a file by replacing the numbers with another set of numbers. Sort of swapping the values, say:
1 = 5
2 = 8
3 = 7
4 = 1
5 = 9 and so on..
so if i have 12345, my output should be 58719.
problem is i get 98719 since after swapping 1 to 5, my sed... (7 Replies)
Hi,
Ive spent ages trying to find an explanation for how to do this on the web, but now feel like I'm :wall:
I would like to change each occurence (there are many within my script) of the following:
to
in Vim. I know how to search and replace when it is just single lines... (2 Replies)
Hello all,
First of all, I could not made up a nice title what explains my problem in short,sorry for that already.
I have the next file which contains the following,
CREATE:ENTRY:\
DNAME,"referenceId=sondakika30,referenceId=User1,\
referenceId=Company,\
... (2 Replies)
Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem.
Very frequently, I need to copy set of references from different sources. Typically, a reference would like this:
Banumathy et al., 2002 G. Banumathy, V. Singh and U.... (1 Reply)
New to scripting.. think i need sed to do the following but need help.
have a properties files with variable i need to replace using substitution
for e.g in x.properties
xslt.root.dir=/apps1/test/cs.war/presentation/xsl
have a shell script with following
echo "Edit... (3 Replies)
Hello,
I have a file that looks like this:
num11 num12 num13 word1
num21 num22 num23 word2
num31 num32 num33 word3
.
.
.
I would like to search for the lines that contain a given number, but I need to narrow the search only to the first field, that means that the number has to... (4 Replies)
I want to retain specific number of backup files in a directory.for example i want to retain only two latest backup file in backup directory. If number of backup files is greater than this policy that it will delete oldest file.Please Tell me whether this is possible or not. (2 Replies)