Page 1 of 1

question: remove characters from certain position

Posted: 01 Jan 2016 12:56
by yusef88
the following script inserts characters into certain position, can the operation be reversed to remove them?

Code: Select all

"Insert Character(s)" $char = input ("Enter the character to insert:");
  $pos = input ("Enter position to enter the character:");
  rename "r", "^(.{$pos})(.+)$ > $1$char$2", "p"

Re: question: remove characters from certain position

Posted: 01 Jan 2016 19:42
by highend
That depends. From the same script (where you still have access to the $pos or $character variable)? Sure. In the same way like before (a rename with a regex pattern and the usage of a range ({})...

Re: question: remove characters from certain position

Posted: 01 Jan 2016 20:26
by yusef88
sorry I'm not familiar with scripts. let's say 4th character is to be removed, how :?:

Re: question: remove characters from certain position

Posted: 01 Jan 2016 20:31
by highend

Code: Select all

rename "r", "^(.{3}).(.*)$ > $1$2", "p"

Re: question: remove characters from certain position

Posted: 01 Jan 2016 21:02
by yusef88
grateful :beer: