Objectmix
Tags Register Mark Forums Read

Emacs function help : lisp

This is a discussion on Emacs function help within the lisp forums in Programming Languages category; I'm trying to create a function for emacs that will allow me to search for a particular string and if found, set a specified number into a specified column (one of the last three). I want to be able to specify the search string, any of the last three columns to set, and what to set the number to. My rows look like this, and for simplicity, I'm using pipes to create columns. 12483W10|000001ER|Headline|4|0|0|0| 00000348|00000348|Headline|1|0|0|0| 00000351|00000351|Headline|1|0|0|0| 000006EE|000006EE|DJWREIT_1|1|0|0|0| 000006EE|000006EE|DJWREIT_1|1|0|0|0| One example, For each row that contains the string "headline" I would like to place a "1" in column "3" (the right-most ...


Object Mix > Programming Languages > lisp > Emacs function help

Reply

 

LinkBack Thread Tools
  #1  
Old 01-22-2009, 06:22 PM
Junior Member
 
Join Date: Jan 2009
Posts: 0
tecoon is on a distinguished road
Default Emacs function help

I'm trying to create a function for emacs that will allow me to search for a particular string and if found, set a specified number into a specified column (one of the last three). I want to be able to specify the search string, any of the last three columns to set, and what to set the number to.

My rows look like this, and for simplicity, I'm using pipes to create columns.
12483W10|000001ER|Headline|4|0|0|0|
00000348|00000348|Headline|1|0|0|0|
00000351|00000351|Headline|1|0|0|0|
000006EE|000006EE|DJWREIT_1|1|0|0|0|
000006EE|000006EE|DJWREIT_1|1|0|0|0|

One example, For each row that contains the string "headline" I would like to place a "1" in column "3" (the right-most column).
12483W10|000001ER|Headline|4|0|0|1|
00000348|00000348|Headline|1|0|0|1|
00000351|00000351|Headline|1|0|0|1|
000006EE|000006EE|DJWREIT_1|1|0|0|0|
000006EE|000006EE|DJWREIT_1|1|0|0|0|

Another example, For each row that contains "djwreit_1" I would like to place a "5" in column "1".
12483W10|000001ER|Headline|4|0|0|1|
00000348|00000348|Headline|1|0|0|1|
00000351|00000351|Headline|1|0|0|1|
000006EE|000006EE|DJWREIT_1|1|5|0|0|
000006EE|000006EE|DJWREIT_1|1|5|0|0|

If someone could help me out with a function that would take the user input (string, number, column) and run through a text file with a few thousand lines, I would greatly appreciate it.

Thanks.
Reply

Thread Tools



All times are GMT -5. The time now is 08:58 AM.

Managed by Infnx Pvt Ltd.