Replace and increment in xemacs 21.4


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Replace and increment in xemacs 21.4
# 1  
Old 02-14-2014
Replace and increment in xemacs 21.4

I am trying to replace and increment a lot of TEST_FONC_1 entries in my file with TEST_FONC_2 then TEST_FONC_3.....
I'm trying to use replace regexp but it doesn't work
I have tried
replace
Code:
_[0-9]+

with
Code:
_\,(1+ \#&)

but it doesn't work. it find the entries but it replace it with the text _,(1+ #&)

So the first expression to replace is found but the thing to replace with is not understood by xemacs.
Thanks

Last edited by Toug; 02-14-2014 at 12:06 PM.. Reason: precisions
# 2  
Old 02-20-2014
no help?
# 3  
Old 02-20-2014
Please post an example of your input file and the desired output.
# 4  
Old 02-20-2014
Input:
Code:
	TEST TEST_FONC_1
.
.
.
	FIN TEST TEST_FONC_1



	TEST TEST_FONC_1
.
.
.
	FIN TEST TEST_FONC_1


	TEST TEST_FONC_1
.
.
.
	FIN TEST TEST_FONC_1



	TEST TEST_FONC_1
.
.
.
	FIN TEST TEST_FONC_1

Ouput:
Code:
	TEST TEST_FONC_1
.
.
.
	FIN TEST TEST_FONC_1



	TEST TEST_FONC_2
.
.
.
	FIN TEST TEST_FONC_2


	TEST TEST_FONC_3
.
.
.
	FIN TEST TEST_FONC_3



	TEST TEST_FONC_4
.
.
.
	FIN TEST TEST_FONC_4

The dots represent code. Change here will be done with normal replace.


Thanks
# 5  
Old 02-20-2014
Code:
awk -F_ '/TEST TEST/ {if(f){f=0;$NF=c;print;next}f=1;$NF=++c}1' OFS=_ file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace and Increment a value in the fixed length file

Hi Everyone, I need to increment a value in the fixed length file. The file has almost a million rows. Is there any easy way to accomplish this. Ex input file ASDSD ADSD 00000 X AAASD ADSD 00000 X SDDDD ADSD 00000 X Ouput ASDSD ADSD 00001 X AAASD ADSD 00002 X SDDDD ADSD 00003 X ... (7 Replies)
Discussion started by: saratha14
7 Replies

2. UNIX for Dummies Questions & Answers

XEmacs compilation errors not understandable

Hi all! I am new to this forum. I have recently installed Cygwin and XEmacs on my laptop running Windows Vista. I am studing at the moment and the code I am creating is mainly for that purpose. I am trying to create the algorithm of Insertion sort. When I compile my code in XEmacs i get some... (1 Reply)
Discussion started by: BlueTower
1 Replies

3. UNIX for Advanced & Expert Users

About to give up on XEmacs 21.5.29

Folks, I am hoping someone out there can help me. I have been writing code for in-excess of 10 years. Throughout all this time I have used Xemacs. I have picked up bits of customizations here and there over the years, but would not profess to be anything of an expert in Lisp (or have a heavily... (3 Replies)
Discussion started by: petermc
3 Replies

4. UNIX for Dummies Questions & Answers

xemacs bindings help

Hi all , I would like to have a new binding so that if im having the cursur on a word, one shortcut click (say f3) whould find the next occurrence of the word in the text and so one. what is the right bind for it ? I tried but its wrong. thanks ! Zvika (1 Reply)
Discussion started by: zismad
1 Replies

5. Red Hat

enable xemacs buffer tabs

I need some help configuring xemacs to enable buffer tabs. please, anybody, could walk me through on how to configure xemacs for this. Thank You. (1 Reply)
Discussion started by: etcpasswd
1 Replies

6. Shell Programming and Scripting

Need help with make file for etags to use it with xemacs

I am trying to generate tags for .cpp & .h source code. Here is the structure of the codes Root/X/src/ Root/X/include/ Root/Y/src/ Root/Y/include/ How do I generate TAGs from ROOT directory such that, when I am working on code under X/src I can access function defined in Y/src/ area? ... (0 Replies)
Discussion started by: sofiandros
0 Replies

7. UNIX for Dummies Questions & Answers

display ^M in xemacs

Sorry, this has probably been posted before, but my searches turn up nothing, and I have tried. using a cygwin distro of xemacs The default is NOT to display CR characters (I expect to see them as ^M). I want to change this so they do show up. Can you tell me please, what command to issue?... (0 Replies)
Discussion started by: scott1256ca
0 Replies

8. UNIX for Dummies Questions & Answers

xemacs colors for C files

xemacs uses default colors for coloring C files how can I change those colors. I could only manage the default background and foreground colors and that too using .Xdefaults file changes. (2 Replies)
Discussion started by: spotnis
2 Replies

9. UNIX for Dummies Questions & Answers

Xemacs and emacs

Hi guys What is the difference between Xemacs and emacs. I assumed Xemacs runs only in X11. What about in Linux on KDE? Am I running Xemacs or emacs. Well it says emacs though. What is the advantage of one over other? What can I run on OS X ? SS (5 Replies)
Discussion started by: saurya_s
5 Replies

10. Programming

xemacs

Hi Folks, Would like to download the xemacs editor for C. I searched the xemacs site but i donno the exact place of download. Can any one pass the URL or way to go thru and download the editor? Thanks in Advance, Nisha (4 Replies)
Discussion started by: Nisha
4 Replies
Login or Register to Ask a Question