Change last Character


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Change last Character
# 1  
Old 10-27-2010
Question Change last Character

Hi,
Someone can help me please,
i have text in file like this:

(a,b,c,d,e),
(f,g,h,i,j),
(k,l,m,n,o),


and i want to change the last character to like this:

(a,b,c,d,e),
(f,g,h,i,j),
(k,l,m,n,o);


last array character "," i want change to ";"

anyone can help me please,,
thanks
# 2  
Old 10-27-2010
Try:
Code:
sed '$s/,$/;/' infile

This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 10-27-2010
MySQL it's work

Woww.. it's work,, Smilie

Thanks a lot Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change the i-th character of the j-th line

Hi, I have a file like #----------------------------------- 3 ! number of parameters of the polynome 0.00000e+00 0 ! fix=0) free=1 1.03916e-03 1 ! fix=0) free=1 0.00000e+00 0 ! fix=0) free=1 3 ! number of parameters 2.16595e-05 0 ! fix=0)... (5 Replies)
Discussion started by: f_o_555
5 Replies

2. Shell Programming and Scripting

How to change last character in string with a variable value.

Hey Guys, I have text such as this. 28003,ALCORN,2 28009,BENTON,2 28013,CALHOUN,2 28017,CHICKASAW,2 47017,CARROLL,2 05021,CLAY,0 The last digit after the final "," is a variable value. This is the base file. I have to do further execution on this file later and I need to update the... (7 Replies)
Discussion started by: chagan02
7 Replies

3. Shell Programming and Scripting

Reverse a change of character

Good morning, i have two chaines of characters to be reversed in shell script (red with blue). It was only one line. Can you help me to write a script in awk or sed? ... (2 Replies)
Discussion started by: khalidou13
2 Replies

4. Shell Programming and Scripting

File deliminated with | character - How do I change 1 value

Hi All, I'm struggling with a problem. Data file example: Brown|32 inches|apple|monkey Green|12 feet|grape|cat Blue|32 inches|banana|dog Black|23 inches|pear|horse I need to change the value '32 inches' in the third line, and only the third line, while keeping the rest of the file the... (7 Replies)
Discussion started by: jsmith_4242
7 Replies

5. Shell Programming and Scripting

rename - change n'th character of regexp

Hi, I wonder if its possible to do the following task using rename (perl v5.8.8). I want to find filenames matching the specific pattern and then change chosen character of this pattern to a given character, e.g. do the following renaming: regexp: 'ab' -----> 'a0b' What's the simplest... (0 Replies)
Discussion started by: pms
0 Replies

6. Solaris

help me to change the character set

dears i am using solaris 10 i am facing a problem when i make setup for solaris i choose the country egypt and i select the language north america but i forget to do that the i found the date Jun written in arabic i want to change character set to written in english -rw-r--r-- 1 root ... (4 Replies)
Discussion started by: hosney00ux
4 Replies

7. Shell Programming and Scripting

how to change every 3rd character

hey champs, i have a files, whose contents are as follows, abcdefghijk lmnopqrstuv .............. .............. i want to replace every other 3rd character to some specified character. let here in this file i want to replace each 3rd character to z. abzdezghzjk lmzopzrszuv... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

8. Shell Programming and Scripting

Change Position of word character

Hi, I have following format in file aaa with content below, and would like to seek help from forumer about how to change and swap the position on 2nd field. 5874957|901125| 95874960|650614| 95874966|870308| 901125 to be changed as 25-11-1990 for eg Can someone help please ?? :) ... (6 Replies)
Discussion started by: cedrichiu
6 Replies

9. Shell Programming and Scripting

Vi single character change

I know this is strictly a programming forum - but I consider vi a programming enabler and the question relates to regex you'd use with awk/sed anyway.... I have a file which is 50,000+ lines long and need to change many many instances of word_word_word to be word+word+word where... (6 Replies)
Discussion started by: Brett Taylor
6 Replies

10. UNIX for Dummies Questions & Answers

change character case

i need to change character case inside a script file. How i can do that? any fucntion? thanks (3 Replies)
Discussion started by: ajaya
3 Replies
Login or Register to Ask a Question