General :: Replace Function Replace More Than One Word With The Same Character(s)?

Apr 23, 2011

Can the Replace function replace more than one word with the same character(s)?

Also, do you know how to access the plugins provided by the gedit-plugins package?

View 3 Replies


ADVERTISEMENT

General :: Use Sed To Replace Number That Is In A String With Word?

Sep 12, 2010

I am trying to replace the first number in a string at the end of the line with the word that matches that number. for example i want to replace 546215 to be five-46215. The command that I have tried is

sed -r 's/5[0-9]{5}$/five-[0-9]{5}/'

View 3 Replies View Related

General :: Sed Code To Replace Character?

May 17, 2011

This is what i doing to remove ( and ) sed 's/(//'|sed 's/)//') Can you offer me some better sed code that remove ( and ) with blank without using pipe (|) . I mean sed code that check ( or ) and replace that with blank character.

View 2 Replies View Related

General :: Bash: Replace All Occurrences Of A Word In The Last Command

Mar 9, 2011

Almost by mistake, I figured out you could do something like:

$ cp foo.data bar1.data
$ ^bar1^bar2

And that runs the same command with bar2.data instead of bar1.data. Now, how about if I have multiple occurrences of the target word? For example:

$ cp foo.data bar.data
$ ^data^index

It only replaces the first data extension. How do I get it to replace both?

View 1 Replies View Related

General :: Replace A Character With The Output Of Some Commands Using Sed?

Mar 16, 2010

rm -f /www/emailout/template.html
TODAY=`date '+%d-%m-%y'`
DBRUN=`ps ax | grep dtd `
sed -e 's/ncTODAY/'"$TODAY"'/g' -e "s/ncdbrun/'"$DBRUN"'/g" /www/emailout/test1.html > /www/emailout/template.html

But, I can't get the output of $DBRUN ?

View 14 Replies View Related

General :: Check Character And Then Replace Depending On Result?

Oct 26, 2010

I have a CSV file with 8 columns. I want to check the 5th column, which will contain a single capitalised letter. If that letter is say "B" I would then like to replace the 2nd column in the csv with an incremental number starting at 0 (basically a count) with a prefix of B (B0000001) Sample row would be:

Code:

C, 0109390,sfs,sfsf,B,blah,blah

Amended row would be:

Code:

C, B000001,sfs,sfsf,B,blah,blah

View 14 Replies View Related

Ubuntu :: Find And Replace With Sed At Beginning Of A Word

Nov 15, 2010

I want to write a small script to rename a bunch of files. Their name is of the form 'long number'|'name'|'extension', for example:

52354Football_part2.flv
2353452Nice_weather_4_ducks.flv

I would like to rename these to:

Football_part2.flv
Nice_weather_4_ducks.flv

If in my script I use something like

Code:
sed s/[0-9]//g
on each file, I will get
Football_part.flv, instead of Football_part2.flv,
and
Nice_weather__ducks.flv, instead of Nice_weather_4_ducks.flv.

how to instruct sed to only remove numbers that are in the beginning of the name in a simple way?

View 2 Replies View Related

Programming :: Replace The Last Character String?

Jan 19, 2011

how to replace last character string. For example

$>export T1=abcde
$>export T2=xyz

how to get result abcdxyz?

View 10 Replies View Related

Ubuntu :: Replace Special Character With A Script

Mar 12, 2011

I need a script that will replace '/' in a variable with ''I have tried the following:

Code:

y=$(echo $1|sed 's///\/g')

The thing is that this approach does not always work. Here is an example:

Code:

user@pc:~$ sh script.sh /usr/var/sakis.txt
z:usr
arsakis.txt
user@pc:~$ sh script.sh /usr/tar/sakis.txt
z:usr arsakis.txt

Is there a way to treat those characters?

View 3 Replies View Related

Programming :: Replace Character With Hex Value Choosing From Shell Cmd Line?

Jun 9, 2011

I am bouncing a file across platforms (windows->solaris->mainframe), and the file is starting out with a "special" character (the registered trademark "circle R") in some of the records. This character is not in the EBCDIC character set on the MF, so it is unrecognizable. The MF developer I am working with asked if it is possible to replace the character with a specific hex value (AF) before it gets to the MF.

I was putzing around with sed, tr, etc. on the ksh command line, hoping to find an easy way to get one of them to substitute hex instead of ASCII. I have found that the usual shell utilities recognize the trademark character, so homing in on what to replace is solved. But I cannot get anything to actually substitute in the hex sequence I want. E.g. I was thinking something like...

>cat special_file | sed 's/R/AF/g'

But my version of sed does not seem to have hex "editing" capability.

View 5 Replies View Related

General :: "find And Replace" In Shell (includes The / Character)?

Feb 27, 2011

I would like to know what shell command I could use for finding a phrase (which is a URL) in many files, with a different phrase. I have tried the "sed" command, but it does not like the forward slash.

View 5 Replies View Related

Programming :: Text File Replace Occurrences Of Three Character String ZZZ With Quotation Mark

Mar 30, 2010

I want to use SED to do the following: In a text file replace any occurrences of the three character string ZZZ with a quotation mark "and. replace all occurrences of a comma with a semi-colon. It is the S/ / / command which is stumping me on the first issue...inparticular how to get the replace string to be quote.

View 9 Replies View Related

Programming :: Replace Specific Character After Specific Line By Awk?

Jul 19, 2010

I want to replace specific character in a file after every specific line. example as follows.

O 000000000000000000
A 111111111111111111
C 222222222222222222

[code]...

View 2 Replies View Related

General :: Replace The Old One.o With The New One.o?

Feb 15, 2010

I am having problem with the ar cmd. I had already created an archive archive.a with two .o files but I have modified one of them now. How do I replace the old one.o with the new one.o?

I used the ru cmd but it is not working. I don't think I am properly using it, this is how I have it so far:

ar ru archive.a one.o. But this is not working.

View 1 Replies View Related

General :: Replace All The C's And C's In It With %1?

Nov 13, 2010

I have a document. I want to replace all the c's and C's in it with %1 all the f's and F's in it with %2. i can get sed to do one of them but for some reason i can't get the script to do all the conversions at once.

View 4 Replies View Related

General :: Search And Replace /'s In VI

Feb 7, 2010

I was wondering how I would search and replace all /'s with -'s in vi. %s///-/g doesn't work obviously.

View 2 Replies View Related

General :: Making RPM Replace Another One

Jul 12, 2011

I want to make an rpm which when installed as an update causes another rpm to be removed. I'm fairly sure this is possible because I have seen LibreOffice rpms install as updates replacing OpenOffice rpms in the process without any interaction being required. However I'm unable to figure out how to do it, even after having looked at the spec file for such a LibreOffice rpm.

I have package gstreamer-0_10-ffmpeg installed. I have another package called multimedia installed. I've built a new version of multimedia which includes the gstreamer ffmpeg plugin so I don't need the gstreamer-0_10-ffmpeg package installed any more. I've tried using Provides and Obsolete in the spec file of the new multimedia package. E.g.

Code:
Provides: gstreamer-0_10-ffmpeg
Obsoletes: gstreamer-0_10-ffmpeg <= 0.10.10
(I've tried it with and without version numbers.) Whatever I put in the spec file, when I try and install the new multimedia package as an update zypper says

Code:
$ zypper up -y multimedia
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: multimedia-1.1-1.i586 obsoletes gstreamer-0_10-ffmpeg <= 0.10.10 provided by gstreamer-0_10-ffmpeg-0.10.10-0.i686
Solution 1: replacement of gstreamer-0_10-ffmpeg-0.10.10-0.i686 with multimedia-1.1-1.i586
Solution 2: do not ask to install a solvable providing multimedia > 1.0-2
Selecting an option manually is no good, I need the update to happen without user interaction.

View 3 Replies View Related

General :: Find Or Replace Without Using Sed?

Dec 27, 2010

I am working on writing a script for find and replace a string using sed.But know I want to write without using sed.

View 9 Replies View Related

General :: How To Replace The Path

Feb 16, 2010

I added a path in my bash_profile so that I could use the executables in the directory (I thought). But it turned out some other directory has the same executables and the path had already been added by the previous user. Is there way to overwrite this path? I can't find where that old path was added.

View 10 Replies View Related

General :: Replace Everything Before @ Symbol?

Nov 13, 2009

I have a list of email address's that I need to sift through to identify only the domain name.

xyz@yo.com
abs@yo.com
clahclah@test.com

I want to remove everything before the @ symbol and only print the domain name. Can anyone assist with this?

View 8 Replies View Related

General :: Replace The () With Xxxx?

Dec 29, 2010

I have a sed question

I got the following

(12121) and I want to replace the () with xxxx

so the output would be

xxxx12121

I am using the following but its not working

sed 's/(.*)/xxxxxx/g' TMP4 > TMP5

View 6 Replies View Related

General :: Sed Replace String Up To Tab

Dec 12, 2009

I'd like a sed command to replace all decimal values greater than 0.5 with nothing in a tab delimited text file.

EX:

There would be one tab before 0.301 and two tabs after it. This way when you paste the text into an excel spreadsheet, there are empty cells where you deleted values.

I thought the sed command would be something like:

But this will delete everything.

What I need is something that will start deleting when it sees 0.[5-9] and stop when it reaches a tab. I know you can use [^character]+ to do this, but it doesn't seem to work with a TAB as the character.

Another idea I had would be to have sed replace from 0.[5-9] to 0. and replace with a tab + 0. But I also cant get [^0.]+ to work as it only works with single characters.

View 14 Replies View Related

General :: Sed To Replace First And Second Instance?

Jul 17, 2011

I might just be crazy or particularly dumb today but what I'm trying to do is have sed replace the first and second instance of a character on a line but not after that.

Basically it is a csv file with a date formatted as dd/mm/yyyy and I need to completely remove the slashes. No problem using:

Code:
sed 's////g' < file > outputfile

The only problem is that one of the columns after this may also contain these slashes and shouldn't be removed.

I must have read every single sed page on the net today to find a way to do it to no avail! Is it as simple as :

Code:
sed 's////1' < file > outputfile

And then run the same on the output file again? these two slashes will always be the first and second slashes in the file.

View 6 Replies View Related

General :: Replace Multiple Spaces By One Tab

Feb 2, 2011

Ive some textfiles which contains some colums seperated by a various number of spaces, but instead i need one single tab as a seperator.

View 5 Replies View Related

General :: How To Replace Sendmail With Postifx

Mar 9, 2011

Been using the Amazon EC2 Linux AMI and enjoying it.It comes configured with sendmail. I think I'd rather use postfix.replacing sendmail with postfix might be as simple as what I found searching online:

$ rpm -e sendmail
$ yum install postfix.

However rpm complains:

$ rpm -e sendmail
error: Failed dependencies:
smtpdaemon is needed by (installed) mdadm-2.6.9-3.7.amzn1.i386

View 1 Replies View Related

General :: Can Replace Windows With Wine

May 10, 2011

I will buy a new computer and install Kubuntu on it.The only kind of software that I would run on Windows are PC games. Can I play most of Windows games without problems with Wine on Linux?If Wine cannot run games, how much of disk partition is recommended to install Windows and PC games? Can Windows read ext4 partitions?

View 5 Replies View Related

General :: Replace One Line For Another In File?

Dec 1, 2010

I trying to change a file with hundreds of entries, replacing line with "IP Address Number" for "Host Name", one for another.

this is the original: [IP Address Configuration : "172_17_27_161.SUBNET_U"] IP Address Number = 172.17.27.161Assignment Type = 8Host Name = CAST124Last Used = 1290499294000MAC Address = 1 00 16 35 74 4C 59Client Identifier = 01 00 16 35 74 4C 59and the result desired is: [IP Address Configuration : "172_17_27_161.SUBNET_U"]Host Name = CAST124Assignment Type = 8IP Address Number = 172.17.27.161Last Used = 1290499294000MAC Address = 1 00 16 35 74 4C 59Client Identifier = 01 00 16 35 74 4C 59I know how to change one character by another with sed, but not to change a line for another, because I don't know in which line number it is.

View 3 Replies View Related

General :: Find And Replace String?

Jul 26, 2011

I need to find this "TYPE=MyISAM;" and replace with "ENGINE=MyISAM;" in all .sql files in a directory. How can I do this with sed?

View 2 Replies View Related

General :: Vim Replace All The Same Words In A Certain Line?

Dec 2, 2010

15 for(i = 0; i < N; i++) I want to replace "i" with "test" in the line above,whose line number is 15. When I tried this command :15s/i/test/ Line 15 turned to be this: for(test = 0; i < N; i++) It only replace the first "i",but I want to change all "i" in line 15.

View 3 Replies View Related

General :: Replace Nvidiafb With Another Driver?

May 13, 2010

I'm running Ubuntu 9.10. I've tried installing the correct nvidia-glx driver for my added AGP card but keep getting an error about another driver is working, which is the generic nvidiafb one. How would I disable or remove it to install the correct one

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved