Sponsored Content
Top Forums Shell Programming and Scripting Script to replace numbers by string Post 302393208 by Michi21609 on Monday 8th of February 2010 07:02:00 AM
Old 02-08-2010
Oh, I'm sorry!

Examples:
---------
Car1Something.png --> CarOneSomething.png
Flower6Number_7.png --> FlowerSixNumber_Seven.png
Foo_5_Bar.png --> Foo_Five_Bar.png

I thought about it already, but thanks for the tips! Maybe I will get it by myself...

Thanks!
Michael
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String replace perl script error

I have written down a simple perl program to replace a string from a word file. My script does'nt seem to work. Any pointers to make it work will be appreciated. The code is given below. #!/usr/bin/perl while (<>) { open(FILE,$_); while (<FILE>) { s/This/I did it/g; }... (6 Replies)
Discussion started by: MobileUser
6 Replies

2. Shell Programming and Scripting

Replace a random string of numbers

Hi Can someone help me with this one? I have string.. (PROC_PROC_ID == 12183) <--PID is dynamic and i want to replace the PID number with whatever PID from /opt/hpws/apache32_2/logs/httpd.pid file. i'm having problem since the PID on the string is dynamic. It may be 2-5 digits or more. ... (5 Replies)
Discussion started by: ryandegreat25
5 Replies

3. UNIX for Dummies Questions & Answers

Replace US numbers with European numbers

hey, I have a file with numbers in US notation (1,000,000.00) as well as european notation (1.000.000,00) i want all the numbers to be in european notation. the numbers are in a text file, so to prevent that the regex also changes the commas in a sentence/text i thought of: sed 's/,/\./'... (2 Replies)
Discussion started by: FOBoy
2 Replies

4. Shell Programming and Scripting

Requesting help to replace a string by my bash script

Hello every1, I need help to replace a string in a file by my bash script. Find: log4j.appender.toLogFile.layout.ConversionPattern= %d %5p (%F:%L) - %m%n= %d %5p (%F:%L) - %m%n Replace: log4j.appender.toLogFile.layout.ConversionPattern= %d %5p (%F:%L) - %m%n I tried by sed, but kept... (7 Replies)
Discussion started by: titanic4u
7 Replies

5. Shell Programming and Scripting

script to replace numbers on lines according to condition on the same line

hello everyone my file contains many records, the following is a sample: BEGIN ASX1500000050002010120000000308450201012000177 ASX1100002000000201012000000038450201012000220 ASX1600100005000201012000000038450020101200177 ASX1900100006000201067000000058450020101200177... (2 Replies)
Discussion started by: neemoze
2 Replies

6. UNIX for Dummies Questions & Answers

How to perform string replace in shell script?

I have value like ABCDEF,BBCCDD in a shell variable, now i would like to have ABQWEF,BBQWDD in the same shell variable. How can i replace the char at position 3&4 with QW in shell script? (3 Replies)
Discussion started by: vel4ever
3 Replies

7. Shell Programming and Scripting

Replace string ids with unique numbers

Hello, I have a file with a 1000 ids in the form of strings. I want to replace each id with a unique numbers in the whole file. each id is repeating in all the columns. I know I can use sed command but there are many ids in file which are need to be converted example of input file B752... (4 Replies)
Discussion started by: ryan9011
4 Replies

8. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

9. Shell Programming and Scripting

cant figure out the error in this script (adding numbers in a string) using ubantu shell

hii please help me this is the script num=$1 sum=0 while do x=`expr $num % 10` sum=`expr $sum + $x` num=`expr $num / 10` done echo "Summation is $sum" it is giving error pratyush@ubuntu:~$ sh shell.sh 123 shell.sh: 11: 123: not found Summation is 0 (3 Replies)
Discussion started by: Pratyush Sakhle
3 Replies

10. Shell Programming and Scripting

Script to replace a string with pattern read from a file

I have two files blocks.txt and rules.txt. In blocks.txt i have the following entries Linux1 Linux2 Linux3 ..... Linux10 In rules.txt i have the lines where a filename pattern starts like 'blk-name.*' I want to replace 'blk-name' with the names read from blocks.txt file I tried... (2 Replies)
Discussion started by: Jag02
2 Replies
ARRAYOBJECT.NATCASESORT(3)						 1						ARRAYOBJECT.NATCASESORT(3)

ArrayObject::natcasesort - Sort an array using a case insensitive "natural order" algorithm

SYNOPSIS
public void ArrayObject::natcasesort (void ) DESCRIPTION
This method is a case insensitive version of ArrayObject::natsort. This method implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value asso- ciations. This is described as a "natural ordering". PARAMETERS
This function has no parameters. RETURN VALUES
No value is returned. EXAMPLES
Example #1 ArrayObject.natcasesort(3) example <?php $array = array('IMG0.png', 'img12.png', 'img10.png', 'img2.png', 'img1.png', 'IMG3.png'); $arr1 = new ArrayObject($array); $arr2 = clone $arr1; $arr1->asort(); echo "Standard sorting "; print_r($arr1); $arr2->natcasesort(); echo " Natural order sorting (case-insensitive) "; print_r($arr2); ?> The above example will output: Standard sorting ArrayObject Object ( [0] => IMG0.png [5] => IMG3.png [4] => img1.png [2] => img10.png [1] => img12.png [3] => img2.png ) Natural order sorting (case-insensitive) ArrayObject Object ( [0] => IMG0.png [4] => img1.png [3] => img2.png [5] => IMG3.png [2] => img10.png [1] => img12.png ) For more information see: Martin Pool's Natural Order String Comparison page. SEE ALSO
ArrayObject::asort, ArrayObject::ksort, ArrayObject::natsort, ArrayObject::uasort, ArrayObject::uksort. PHP Documentation Group ARRAYOBJECT.NATCASESORT(3)
All times are GMT -4. The time now is 10:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy