Search Results

Search: Posts Made By: mingch
4,154
Posted By nezabudka
BNFILE=$(echo "${FNFILE%.txt}" | sed...
BNFILE=$(echo "${FNFILE%.txt}" | sed 's/[1-9][0-9]\{,10\}$//')
OLDNUM=$(echo "${FNFILE%.txt}" | sed 's/.*[^1-9]\([0-9][0-9]*\)/\1/')
4,154
Posted By bakunin
The reason is that "012" is not a number. "12" is...
The reason is that "012" is not a number. "12" is a number and you can increment that to "13". But "012" and "013" are strings and you cannot do calculations with strings.

You haven't told us yet...
4,154
Posted By RudiC
For your latest request - increment the last...
For your latest request - increment the last number in the file names - , on top of the "parameter expansion" proposed by bakunin, "arithmetic expansion" could help. Its syntax is (( variable /...
4,154
Posted By bakunin
A few things: The first is: any...
A few things:



The first is: any command involving sed .... | sed ... is (99.99999% of the times) wrong: sed is perfectly capable of handling several commands in a script with loops, branches...
4,154
Posted By apmcd47
$ < file.txt sed...
$ < file.txt sed 's/.*[^0-9]\([0-9][0-9]*\).txt$/\1/'
4567
789
099
012
13or$ sed 's/.*[^0-9]\([0-9][0-9]*\).txt$/\1/' file.txt
4567
789
099
012
13

Andrew
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 02:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy