Ubuntu :: Replace Strings Containing Special Characters With Sed?

Jan 4, 2011

here's my newbie question - I want to change the following string in text files

Code:
E:MP3
with the following string using sed:

[code]....

View 3 Replies


ADVERTISEMENT

Software :: Using Sed To Replace Special Characters In A File?

Mar 24, 2011

I have a file with special characters that need to be replaced. I've been working on this for a day and have run out of time.

Example: FILE='/var/tmp/S0000000.LOG.March-24-2011:10:51.tar'

Need to replace the ' with a " on all lines in the file.

View 2 Replies View Related

General :: Using Sed To Replace String With Special Characters In XML File?

Apr 29, 2011

I am having difficulty getting sed to replace a string of text in an XML file, despite the fact that I have no trouble using grep to find that same string. Since the new string and old string to be replaced contain a lot of special characters, I thought it best to store them in variables as opposed to using a slew of backslashes:

OLD_STRING='<property name="webServiceHost">${jboss.bind.address}</property>'
NEW_STRING='<!--<property name="webServiceHost">${jboss.bind.address}</property>-->'

[Code]....

View 2 Replies View Related

General :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 Replies View Related

General :: Search And Replace String Having Multiple Special Characters

Aug 26, 2009

Below is extract of my file:

What I need is to replace "--destination-path=" with "--destination-path=/home/dest"

i.e. desired output is ----destination-path=/home/dest

I could achieve it with below command

$cat outgoing-xfer|grep destination-path|perl -pi -e "s/destination-path=/destination-path=/home/dest/g"

But the problem is that in this case i just wanted to append "/home/dest" for which I could easily escape "/" with just two "", but I wonder if i have a long path like "/a/b/c/d/e/f/g/h/i/j" I will have to escape so many /. Is there any other way by which I can avoid escaping forward slash.

I tried following:

But receiving follo error

Bareword found where operator expected at -e line 1, near "s/destination-path=/'destination-path=/home"
syntax error at -e line 1, near "s/destination-path=/'destination-path=/home"
Bad name after dest' at -e line 1. tried with enclosing in double quotes as well but in vain

View 5 Replies View Related

Programming :: Replace Txt Between 2 Strings?

Aug 4, 2010

I am trying to replace a section of a file between the first instances of the strings {}, with the contents of another file. Example of the format of the file I'm trying to modify

Code:

Servername=something.com
hosts {
macaddress1
macaddress2

[code].....

Then captured all the "macaddress#"s to a variable and used sed to swap

sed "s/$CURRENTDATA/$NEWDATA/" filename

However I get 1 of 2 errors,

Using a small number of macs in "$NEWDATA"

sed: command garbled: s/ macaddresshere

Or when using a large number of macs in the $NEWDATA variable get

bash: /usr/bin/sed: Arg list too long.

how to replace a large block of txt in one file with another large block from another?

View 6 Replies View Related

Ubuntu :: KDE 4.4 - Compose Key And Special Characters

Feb 15, 2010

I am trying to type German Umlaut letters on an English keyboard using kde 4.4. For some reason I seem unable to figure out how to do that (I have just recently switched to kde, was using gnome before). I have looked through various threads and the kubuntu wiki [URL], but can't get the compose key to work. In gnome I used to type "AltGr" plus "[" followed by a vowel and thus get my Umlaut - before I fiddled with the system settings this worked in kde, but only in firefox & Open Office (I assume they are gtk apps).

Since it did not work in Kmail, I went to the system settings, set up a ComposeKey (AltGr, but also tried rightWin), but it doesn't change anything for the kde applications. It only means that the old key-combination now stopped working in firefox and OO. In the system setting of kde 4.4 I can't see the options to enable xkb-options, but I assume the advanced options of the keyboard layout are xkb-options of previous kde releases. I unticked the box 'reset old options', but nothing changed. I type a lot of German text, so using a character map is not an option.

View 2 Replies View Related

Ubuntu One :: Special Characters In One Tomboy Web View?

Apr 15, 2010

Just a small issue:I have a note in Tomboy called "Today's tasks".When I access the synchronised note on Ubuntu One, in the tabbed view it is called:"Today's tasks"Perhaps someone working on this would like to investigate it.

View 2 Replies View Related

General :: $@ >> File With Special Characters?

May 21, 2010

Simple logging script that allows user to enter quick notes and questions, but I can not get it to pass punctuation '?. no matter what I type after 'n' i need that to be inserted at the end of the working project note file.Any help and working examples would be appreciated, but please also direct me to the proper reading material so I can learn something - not looking for someone to just do it for me.usage:

Code:
bob@smith:~/notes$ n bob's script sucks?
>

[code]....

View 14 Replies View Related

General :: Write Special Characters In UTF-8?

May 25, 2011

I want to be able to enter special characters into OOWriter and gedit. Ubuntu supports UTF-8, and I've no idea how to use it.

View 1 Replies View Related

General :: Special Characters Don't Appear In GNOME

Jan 21, 2011

I am trying to make specifically Norwegian characters appear properly. Right now they look like this:

[URL]

Characters like turns the same. This is a font that I downloaded called PT Sans. The letters I want are included, they just don't appear right in the GNOME environment, it seems. They work just fine in other applications, such as OOo Writer. I'm using Ubuntu 10.04.

View 7 Replies View Related

Ubuntu :: NTFS USB Drves Mount With Special Characters?

Oct 24, 2010

I'm running mythbuntu 0.21 on a hardy environment. I had a thread under mythbuntu but i think this was the wrong forum. So here it is again

<lameexcuse>
Currently i hesitate to upgrade to lucid because i fear problems coming up which i do not have the time to solve.
The machine works generally fine so why upgrade to lucid?
</lameexcuse>

[Code]...

View 3 Replies View Related

General :: Using Find And Tar With Files With Special Characters In The Name?

Jun 1, 2010

I want to archive all .ctl files in a folder, recursively.tar -cf ctlfiles.tar `find /home/db -name "*.ctl" -print`The error message :tar: Removing leading `/' from member namestar: /home/db/dunn/j: Cannot stat: No such file or directorytar: 74.ctl: Cannot stat:No such file or directoryI have these files: /home/db/dunn/j 74.ctl and j 75. Notice the extra space. What if the files have other special characters? How do I archive these files recursively?

View 2 Replies View Related

General :: Write Special Characters (like |, ~, Alt, +, 124 In Windows)?

Apr 15, 2009

I've always been connecting to linux machine from windows computer, using putty.

Now the situation changed and I have a question:

How the hell can I write special characters (like | ~ Alt + 124 in Windows)?

View 4 Replies View Related

General :: KDE - File Names With Special Characters ?

Feb 20, 2010

I am running gentoo openbox(rox file manager and desktop) I installed Digikam and Amarok. But I have problems with files which include special character in their names(such as �,�, �,ğ... ) The files are shown with strange and weird characters in the file dialogs of Digikam and Amarok.

I don't have this problem in other applications. I can create files with special character included. I think some settings do not agree with KDE4. How can I solve this problem? Does anyone have an idea? I also installed KDE systemsettings program but could not find a relevant config option for character encoding.

View 2 Replies View Related

General :: Special Characters In PDF Creation With PHP On Suse?

Apr 13, 2011

We are creating PDFs from different sources using PHP, Zend_PDF class and Zend server (based on apache2). Developping on windows the PDFs are OK. If we deploy the application on testing server running SuseLinux the special characters ( ) don't show. We use 1 of the standard fonts, HELVETICA and have tested without success COURIER.

The system

Do you have an idea what to do or try?

OK - it turned out to be a coding question. I had thought that some system variable might cause the problem but we simply had to clean the input data and got it working.

View 1 Replies View Related

General :: GREP - Search Special Characters

Feb 10, 2010

I need to search for the following pattern with GREP in a text file:

So I tried already:

But none of those works...I think probably because GREP doens't like the special character > in the middle of the serach pattern.

At the end I just need to now if GREP found the pattern in the file or not, so it should give me a 0 or a 1 back, once I check the value of the variable "?" after using the grep command.

View 4 Replies View Related

Programming :: Remove Special Characters From String

Jan 30, 2011

I am reading strings from a file using readline() function,the file contains some strings which has only special characters, I need to avoid the strings which has only special characters, the special characters are not similar. How to do it in python.??

View 2 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

Debian Programming :: Using Perl To Replace Filename Strings In A Directory

Jun 12, 2013

I have a directory of orchestral music .ogg files from a family member. Each track is from a different artist and the CDDB entry adds a ":" character after the artist name in the track title.

Here is an example of what I am referring to:

Code: Select all13_-_Mozart:_Sonata_in_A_major_KV_331.ogg

I would like to parse file names in any given directory and search for the string Code: Select all: and replace it with Code: Select all_ According to this post on stackoverflow, I can use Perl to accomplish this task. I've tried Code: Select allperl -i.bak -pe 's/:/_/' but since I am still learning Perl I'm probably commiting a PEBKAC error.

How would I go about solving this issue with regular expressions using Perl?

View 3 Replies View Related

General :: Tar Fails To Extract Archive Containing Special Characters?

Jun 5, 2011

The command tar -xvf wpa_tables.tar gives this error

tar: ./xai-0/334Regency: Cannot open: Invalid or incomplete multibyte or wide character
tar: Exiting with failure status due to previous errors

Obviously the backslash is giving tar some problem, but I've been all over the docs and can't figure out how to either make it skip this file or interpret the character literally. Here's my command history to show some of the options I've tried which don't work.

tar --no-wildcards -xkvf wpa_tables.tar
tar --exclude ./xai-0/\334Regency -xkvf wpa_tables.tar
tar --exclude "./xai-0/\334Regency" -xkvf wpa_tables.tar
tar --ignore-command-error -xkvf wpa_tables.tar
tar --ignore-failed-read -xkvf wpa_tables.tar
tar --transform 's/\/slash/g' -xvf wpa_tables.tar ./xai-0/\334Regency

I'm totally out of ideas at this point and would welcome some input from more experienced members.

View 1 Replies View Related

OpenSUSE Install :: Spanish Special Characters Don't Show Up In Yast Nor In Vi?

Feb 8, 2010

Now the messages in certain programs, like yast or in the console, are in spanish, but the special characters are written wrong:

felisa:~ # man ls
Man: find all matching manual pages
* ls (1)

[code]...

View 1 Replies View Related

OpenSUSE Install :: Batch Rename Files With Special Characters?

Dec 10, 2010

I have about 300 files that need renaming, because the file system does not display the French characters properly. The dodgy letter in question has been replaced by a "question mark in a black diamond" symbol.No way of renaming, other then using mv in the Konsole has worked. Is there any way, script or program out there, that will do a batch rename?

View 9 Replies View Related

Programming :: Write A Utility Which Will Scan In A Text File And Search And Replace Strings?

Jul 16, 2010

Something very handy to do in a Linux shell, is manipulating files and strings - essentially parsing data. Write a utility which will scan in a text file and search and replace strings. We also want to keep track of how many strings we've replaced.

I know that my command would look like this: <utility name> <filename> <stringToSearchFor> <stringToReplaceWith>
Code: #!/bin/bash

[code]....

View 2 Replies View Related

OpenSUSE :: Unable To Find Frequently Used Special Characters And Symbols In Novell

Oct 11, 2010

1. Unable to find frequently used Special Characters and Symbols in Novell openoffice writer. 2. How to import more symbols for writer while using Special Characters in Writer.

View 9 Replies View Related

General :: Bash : Pass Command Line Arguments Containing Special Characters?

Jul 14, 2010

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?

(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 7 Replies View Related

General :: Rsync On Windows To Make It Keep Special Characters In File-names

Sep 2, 2010

We're in the process of implementing an offsite backup of all our servers to a remote Linux server. We're using rsync over ssh.What I've found is that characters such as ±, ¶,´ and £ are replaced on the Linux server with underscores.I don't mind if it changes these characters in the filenames of documents, but when it renames a language pack from Espa±ol.clx to Espa_ol.clx, it could cause issues for us further down the line.

What do I need to do differently to make the special characters copy over correctly? For the initial sync which will take place locally, before the machine is moved offsite, I have SAMBA enabled. I am able to copy files from Windows to the Samba share, retaining the original filename, though it looks different in the Linux directory listing, i.e. t̻st becomes ĻstThese files get deleted by rsync when it runs, as it does not match the filenames.

View 1 Replies View Related

General :: Bash: How To Pass Command Line Arguments Containing Special Characters

Jun 24, 2011

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program (there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]". Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.? (Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 8 Replies View Related

General :: Include Special Characters When Sorting Files By Name (Fedora 12 I386)?

Feb 15, 2010

I am dragging my files over to a new Fedora 12 installation and I just noticed that special characters are not taken into account when sorting files by name (I want '_js' to come before 'images').Is there a way to make the sorting process behave like Windows, where files starting with a special character are listed first?

View 5 Replies View Related

Programming :: Change A Line In A File Code - Sed Special Characters Bash Script

Jan 26, 2011

I'm having issue when trying to change a line in a file

[Code]....

View 1 Replies View Related







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