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


ADVERTISEMENT

Software :: Using Sed To Search And Replace Does Not Accept Spaces?

Feb 16, 2011

Back to the problem: I wrote a little bash script that people around here can run to search and replace strings in the current directory and all subdirectories. However, whenever there is a space in the new string (the one doing the replacing), I get this error:

Sed: -e expression #1, char 9: unterminated `s' command

My code looks like this:

Code:
find ./ -type f -not -name find_SNR.sh -exec sed -i 's/'$FIND_SNR_STR1/$FIND_SNR_STR2/'' {} ;

View 5 Replies View Related

Ubuntu :: Replace All Tab Stops In A Text File With 4 Spaces?

May 18, 2011

How can I make vi and nano such that when I press the tab key, it automatically replaces the tab with 4 spaces?

View 5 Replies View Related

Programming :: Replace Spaces With Underscores In File Names?

Jan 11, 2011

I often get files with many spaces as part of their names. I would like to automatically replace these spaces with underscores, but otherwise not change the file name. Is there a way to do this task with just the bash shell?

View 4 Replies View Related

Software :: Make Mcedit Not Replace Tabs With 8 Spaces?

Mar 17, 2010

How to make mcedit not replace tabs with 8 spaces?

View 2 Replies View Related

Programming :: Sed - Replace All Spaces At Beginning Of Line With The Number 1?

Jun 21, 2010

Does any one know what syntax i could use to allow me to replace all instances at the beginning of a line with ones.

Before :

Code:
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
Logical device name : RAID1Mirror
RAID level : 1
Status of logical device : Optimal

After

Code:
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
111Logical device name : RAID1Mirror
1111RAID level : 1
11111Status of logical device : Optimal

View 12 Replies View Related

Programming :: Rename File Names : Replace Dots By Spaces, Keep The Extension?

Mar 28, 2011

I am trying to rename a lot of files but need to keep the extension :

the files are films names :

a.b.c.d.***.iso

the result should be replacing "." by spaces " "

this command :

for files in *.iso ; do mv "$files" `echo "$files" | tr '.' ' '`; done

put a space also before the extension iso ??

How can I rename files from

"a.b.c.d.iso" to "a b c d.iso"

View 5 Replies View Related

General :: Shell - Rename A File From Something Without Spaces To Something Containing Spaces?

Jan 26, 2010

Is it possible, in Linux, to rename a file from something without spaces to something containing spaces? I know I can create directories and files with spaces by doing:

mkdir "new dir" and:

touch "new file.txt"

I want to rename files from:

imgp0882.jpg to something like:

20091231 1243 some topic.jpg

And how would it look in a shell script that uses parameters like:

for i in *.jpg do
rename "$i" "$somepath/$mydate $mytime $mytopic$extension"
?

I'm new to Linux (using PCLinuxOS 2009.2), coming from Windows, and I've written myself a little shell script to download files from my camera and then automatically rename them according to a date-and-topic pattern. As you can guess by now, I'm stuck on the bit about renaming. If you want to see my script, here's a copy. I'm not using jhead for this renaming because that only works with JPEG files but I want a single solution for any media format including videos.

View 2 Replies View Related

General :: Replace Multiple Instances From X To Y In Line

Feb 1, 2010

I have a line of text with multiple web links in the line. I'd like to replace the actual links with the text "<web-link>" so I don't accidentally hit them while reading on my iphone. I've tried many versions of the following sed command, sed 's/(http.*)/<web_link>/g', but it simply replaces everything between the first instance of "(http" and the last instance of ")" with <web_link>, or does nothing at all.

Ex: This line has a link to a web page (http://www.webpage.com/file.html) then some more text (extra text) and then another link (http://www.nextwebpage.com.index.html) to a website.
$ echo "This line has a link to a web page (http://www.webpage.com/file.html) then some more text (extra text) and then another link (http://www.nextwebpage.com.index.html) to a website." | sed 's/(http.*)/<web_link>/g'

What I get is: This line has a link to a web page <web_link> to a website.
What I'd like is: This line has a link to a web page <web_link> then some more text (extra text) and then another link <web_link> to a website.
What am I doing wrong with my sed command?

View 4 Replies View Related

General :: Find & Replace String In Multiple Files?

Jan 15, 2010

After hours (literally) of searching the web and reading man pages, I think I've come up with the following:Code:find . -exec grep 'path/to/file' -print | xargs -0 -I new_path mv {this is where I get confused}So my code above is incomplete, obviously. In order to finish replacing the string, I need to mv the new file into the old file's spot. How do I do this, by incorporating it into my line of code?

View 14 Replies View Related

General :: Search And Replace Line In Multiple Files?

Jul 13, 2010

Hello, I need some help searching through multiple files, finding a line and replacing that line. The line I am searching for is:

password key ******* 1222554

ultimately I want to be able to delete the numbers after the asterisks . my thoughts are to create a script that will search for the line password key ******* and delete it then replace it with password key ******* my files are located in /opt and they are all txt files.

View 13 Replies View Related

General :: Replace A String In Multiple File & Sub Directories?

Aug 31, 2010

Need to replace the following string :

By

In multiple .exp files and in sub directories.

View 5 Replies View Related

Ubuntu :: Replace Multiple Lines In Multiple Files?

Aug 20, 2011

I often use the rpl command to make changes to multiple html files at once. For example:

rpl -R '<br />' '<br /><br />' mydirectory However, I haven't been able to figure out how to change multiple lines. For example, let's say I want to change all occurrences of :

<br />
<br />
to:
<br />
I've tried
rpl -R '<br />
<br />' '<br />' mydirectory

but that didn't work. how to do this with rpl or some other way?

View 9 Replies View Related

General :: Emacs - Search And Replace Regex In Multiple Buffers?

Apr 7, 2009

I'm fairly comfortable with emacs but I can't seem to find how to do this. I deal with a lot of text files and find myself performing a lot of regular expression replacements to correct the formatting of the text -- or to extract certain tidbits of data from large ugly-looking files.

I know how to perform a regular expression replacement in one buffer at a time. But how do you perform a regular expression search and replace across all open buffers? I have found a method to perform a regex search and replace across a directory by marking files but I need to do it in the open buffers.

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

General :: Replace ":" From Multiple Files Names - Even Recursively In Directories

Jan 31, 2010

I need to replace ":" from multiple files names, since I am going to copy those files from a linux partition, which admit the ":" to a FAT32 partition, which does not.

Example:
original name: eg06_ana_21-05-06_09:21:03.JPG
wished name: eg06_ana_21-05-06_09-21-03.JPG

I have googled a lot but I have not been able to adapt the examples given by people to my aim.

It seems that rename command is what I should use, but I have no idea to build the correct pearl expression.

View 3 Replies View Related

Software :: Retain Multiple Spaces And Tabs In A File By C-sh File Operation?

Feb 21, 2011

Iam reading a file using C-sh script after manipulating the variables I need to dump into a new file. This in working fine but I couldn't retain the multiple spaces and tabs in a same line. For readability I want to print it back as I read. Now script treating multiple tabs as onl tab or space.

View 3 Replies View Related

Ubuntu :: Replace String In Multiple Files Using Sed?

Jul 4, 2011

I am trying to replace a string (url) in 100s of files located in different directories. I found the sed command but cannoy get it to work. First I locate the files that have the string in them:

Code:
grep -ilr 'url' *
this works correctly and displayed the location of the files that have the string:
Code:
1/index.php
2/index.php

Now I need to replace the string so I combined it with sed:

[Code]...

View 3 Replies View Related

Programming :: Awk Multiple Line Search And Replace?

May 1, 2011

I am trying to search and replace a multi line pattern in a php file using awk.The pattern starts with

<div id="navbar">
and ends with
</div>

[code]...

View 3 Replies View Related

Server :: Find And Replace In Multiple Files In Ssh?

Jul 3, 2010

Find and replace in multiple files in ssh?

View 1 Replies View Related

Programming :: Find And Replace Multiple Instances?

Aug 13, 2010

I have a file with the following in it:

:0 local /usr/X11R6/bin/X -nobanner
:1 local /usr/X11R6/bin/X

I need to add "-nolisten tcp" to both of these lines and cannot figure out how to do it. I can get it to do the first one, but not the 2nd and so on. How do I search the file and loop though it to change them all?

View 14 Replies View Related

Programming :: Replace Html In Multiple Files (80+)

Mar 2, 2010

I want to change some HTML in my files (80+ so I prefer not to do this by hand). I got a script to replace a string in files, however the HTML I want to replace contains an enter (and tab of 4 spaces) (explanation below) Does someone know how I could update my HTML by using a function in Linux?

I also found sed but don't know how to use it with the enter (linenumbers will not work because they variate)...

[Code].....

View 2 Replies View Related

OpenSUSE Install :: Replace GRUB With Multiple Distros

Jun 21, 2011

I have used the following

Code: #Don't change this comment - YaST2 identifier: Original name: none# title Ubuntu 10.04 booting via symlinks kernel (hd0,6)/vmlinuz root=/dev/disk/by-id/ata-ST9500325AS_6VE3ZHX6-part7 ro quiet splash initrd (hd0,6)/initrd.img for Ubuntu for some time. Can this symlinks-booting technique (with the appropriate partition numbers/names) be used for LinuxMint and/or Fedora ?

Currently, I have one PC with Ubuntu's GRUB2 managing multiple distros (openSUSE 11.3 and 11.4, Ubuntu, Linux Mint and Fedora) with Windows 7. I would like to replace it with the openSUSE GRUB, and the Ubuntu, LinuxMint and Fedora are rarely used.

View 8 Replies View Related

Ubuntu :: Having OpenOffice Replace Multiple Words Simultaneously

Apr 27, 2011

I have a list of approximately 50 words that I'd like to search documents for and delete those words. I was wondering if there is some type of automated process for removing multiple words rather than me manually putting each word into 'find and replace'

On that note I guess I could write the Macro in python if there isn't anything out there that does this. However I read that open office only works with python 2.3.5 or something of that nature, and I have already installed 3.1. Is that still going to be an issue?

View 2 Replies View Related

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

Ubuntu :: Multiple Search And Replace In Documents - Creating A Sed Script?

Jul 16, 2011

I want to do search and replace in multiple files. I've seen that it possible to create a sed script but I haven't got the talent to do it myselfWhatd is to locate all instances of a word - lets say 'day' - and replace it with for example 'night' in all odm-documents in a specific folder. It would be great if the search only matched whole words and was case sensitive.

View 1 Replies View Related

Ubuntu :: Command Line - Find And Replace Text Within Multiple Files?

Aug 28, 2010

I'm pretty sure this is doable from the command line, but my CLI skills have degraded a lot since my pre-Y2K admin days. The goal is to search all the files in the directory for a very long string of text and replace it with another string of text. The text being searched for is my Google Adsense code (which will be stripped from my website) and it will be replaced with a placeholder so I can easily tack something else in there in the future.

Seeing how I have that long snip of code on about 100 pages, automating the process would make life easier.
If I was searching for a single word, I can see ways to do this.
If I paste the code I'm searching for into a text file, is there a way to:
find (contents of oldstring.txt) and replace with (contents of newstring.txt)?

View 9 Replies View Related

General :: Using Tilde And Spaces

May 26, 2010

I'm trying to use a tilde '~' for a filename. This works fine normally Code: rm ~/File
But when I have a file with a space in in and enclose it in quotes it takes it literally.If a word begins with an unquoted tilde character (�~�), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix.

View 5 Replies View Related

General :: How To Kill A Process With Name Having Spaces

Dec 10, 2010

A process with name=example can be killed by killall -9 example

How to kill multiple instances of following command which contain spaces?

"valgrind --tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03"

Following command returns valgrind --tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03: No such file or directory

View 3 Replies View Related

General :: Replacing A Line With Spaces?

Jan 5, 2011

I have a line like

port = 2566

I want to replace it as

port = 8080

how to do this in shell script. when i tried to do this with sed

sed -i 's/port=.*/port='$3'/' /root/$2

it is not recognizing spaces , it works only if line is port=2566 .

View 6 Replies View Related







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