General :: Search & Replace Back Slashes To Forward Slashes In Windows

Feb 11, 2011

Lately I've been needing to delete new untracked files from my versioning system. Being in linux I use: hg status -un|xargs rm And it works nice, but when doing it in windows, hg status lists paths with backslash so that is where stuff goes wrong. So then I try: hg status -un|sed 's/\///g' ...but I get the error: sed: -e expression #1, char 8: unterminated `s' command

Then I try some ascii: `hg status -un|sed 's/o134/o57/g'`...that gets me: sed: -e expression #1, char 14: Trailing backslash And some scripting: hg status -un|sed 's/`echo `/`echo /`/g' ...that gets me: sed: -e expression #1, char 19: unknown option to `s'

I try all the last with any other characters and I get the expected output... so I'm completely lost. I have cygwin, of course, and I want to avoid using a file (that is what I've been doing).

View 2 Replies


ADVERTISEMENT

Programming :: Replacing "slashes" With Back Slashes - Escape Character ?

Jan 7, 2011

Usually if I have to replace a character in a string I used the sed /s/ command. However, I am having some difficulty in doing the same thing when I have the following string in a variable in my shell script and I need to replace all the forward slashes ("/") to backslashes ("").

For example, this is what I am doing:

Code:

Not sure how to escape the slashes in this case.

View 2 Replies View Related

General :: Windows Command Prompt Auto-completion With Forward Slashes?

Jul 26, 2011

I switch between Linux and Windows quite a lot and it's annoying the hell out of me that the Windows command prompt won't auto-complete directory paths when I press Tab if I use forward slashes like in Linux.For example, if I'm trying to navigate to a directory 'bin':

cd /path/to/dir/b <tab> - this won't auto-complete to 'bin'
cd path odir <tab> - this will auto-complete.

Can I tell the Command Prompt to use forward slashes instead?

View 1 Replies View Related

General :: Search A String Having Spaces / Slashes / Colons In Vi Editor

Feb 2, 2010

I need to seach a string containing

the substring of 'New Request object:'

and

the substring of '/0x2ab46b1f90' in vi editor,

how do I accomplish that?

View 7 Replies View Related

General :: Scripting To Convert DOS To UNIX Style Slashes

Dec 17, 2010

Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files

View 2 Replies View Related

General :: Awk: Awking The Right Separator With Slashes - Colons - Commas (date Time And Data)

Jan 4, 2011

I wrote a hack script that outputs the following every so often: Code: 01/04/11 10:33:02: 97,1413,1447,2860 I must leave the data format the same --but I want a special number from it. In this case it's 97 and it's always going to be the first in the 4 columns of comma delimited items. I can extract with this:

Code: cat datafile | awk -F" " {'print $3'} | awk -F"," {'print $1'} But that's really sloppy. Can someone point out a better way of doing this (with awk) and tell me why?

View 3 Replies View Related

Programming :: Count The Number Of Slashes In Each Line?

Jan 18, 2010

I have a file with lines that look like this:

Dev/7_Texas2004/4_Caves/page.htm
Dev/7_Texas2004/5_SanMarcos/page.htm
Dev/7_Texas2004/6_Austin/page.htm

And I'm trying to count the number of slashes in each line. I figured (with my limited knowledge of bash) that the best thing to use would be sed. So I ran this to print "not /": sed '!s////g' file # and eventually adding " | wc -m" to it. and I got the same result as if I ran cat, no modification at all:

[Code]...

View 7 Replies View Related

Server :: Fun With Apache Rewrites Proxies And Trailing Slashes?

Mar 26, 2010

I have a back-end server behind a proxy machine. I would like non-SSL requests to the proxy to be rewritten into HTTPS requests to the back-end server, while not screwing up URLs with missing or misplaced trailing URL slashes. So far, on the proxy side, I have this in a virtual host for port 80:

Code:
ReWriteEngine On
# trailing slash fix:
RewriteCond %{SERVER_NAME} my.proxy.com$ [NC]
RewriteCond %{REQUEST_FILENAME} -d

[Code]...

But adding anything else to the URL fails, as the back-end server name gets stuck into the proxied [URL]... The rewrite log seems okay, I think. So I guess this is failing at the reverse proxy rule? Where am I going wrong?

View 1 Replies View Related

Programming :: Delete Trailing Slashes Using Bash On-board Means?

Dec 8, 2010

I prefer to delete trailing slahes from pathes. Until now I used sed:

Code: $ myPath=/home/ladygaga///
$ echo "$myPath" | sed 's//*$//'
/home/ladygaga I played around to accomplish the same with on-board means of bash without using sed, but for example this line only deletes one trailing slash:
Code: $ myPath=/home/ladygaga///
$ echo ${myPath%/*}
/home/ladygaga// Is there a way to delete trailing slahes with just on-board means of bash?

View 2 Replies View Related

General :: Write A Script To Convert All DOS Style Backslashes To UNIX Style Slashes?

May 20, 2011

How do I write a script to convert all DOS style backslashes to UNIX style slashes in a list of files /

View 3 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 :: Regular Expression In VIM Search And Replace?

Oct 22, 2009

I have two type of lines in a text file example

Code:

x.junk(a,b,YAHOO);
y.junk(c,d);

I want to search and replace the second type of line with the first type i.e. with YAHOO included, so that I have

Code:

x.junk(a,b,YAHOO);
y.junk(c,d,YAHOO);

I am trying to use

Code:

:%s/(.*).junk((.*),(.*)^<YAHOO>);/1.junk(2,3,YAHOO);/

In the above code ^<YAHOO> search is not working (I want lines "except YAHOO"). I know that [^ab] will work for "except a,b" characters. How can I say "except word" in regular expressions?

View 8 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 :: 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 :: Regular Expression Search And Replace In Writer Or Gedit?

Oct 26, 2009

I've got a list of files that I've copied from my terminal and pasted into gedit and into OO.o writer. Since the files are all created by gedit, in each case there is both file and file~. I want to get rid of all the 'file~' lines. I thought I could do search and replace using *~, but this doesn't work.

View 4 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 :: How To Go Back Or Forward A Word In Bash Environment

Mar 3, 2010

How can I move around the bash commandline efficiently?In the Windows prompt, one can go back or forward one word by pressing ctrl and <-/->.What's the equivalent in a bash environment?

View 1 Replies View Related

General :: Use Cd Command To Navigate Back And Forward (like Browser)?

Sep 6, 2011

Is it possible to use cd command to navigate back and forward (like browser)?. Something similar to cd - but it only swaps current and last location. I know I can push dir on stack, it would be great to use cd -> and cd <-, though.

View 3 Replies View Related

General :: Shell Script To Search One File For Contents Of Another And Replace Text?

Feb 3, 2011

Suppose I have a pair of files containing lists. The first file is called contigs.txt and it contains a list that looks like this:

Code:
Contig822
Contig826

[code]...

View 5 Replies View Related

Software :: Search And Replace In QtCreator?

Aug 1, 2010

I just can't figure it out at all!

View 1 Replies View Related

Programming :: Using Sed To Search And Replace Backwards?

Oct 25, 2010

I'm trying to use sed to search and replace backwards. The problem is that I have a shell script that is required to put commas into big numbers. For example

9999999 as 9,999,999

I've tried a few things, but none seem to work:

Code:

$ echo 9999999 | sed -e 's/([0-9]{3})/,1/g'
,999,9999
$ echo 9999999 | sed -e 's/([0-9]{3})$/1,/g' -e 's/([0-9]{3})/1,/g'
999,999,9,
$ echo 9999999 | sed -e 's/([0-9]{3})$/1,/g' -e 's/([0-9]{3})/,1/g'

[ode]....

It would be much easier if I could search backwards! For example Bash parameter substitution style:

Code:
$ echo 9999999 | sed -e 's%([0-9]{3})%,1%g'

View 14 Replies View Related

Programming :: Search And Replace In A Binary File?

Aug 11, 2010

i need to change a binary file, let's say to find and replace username:

find string: "/home/name/bla-bla-bla/ "
new string: "/home/anewname/bla-bla-bla/ "

i can do it, for example, in emacs (hexl-mode), but interesting in writing a script instead. it will be much more better for me if i could do it automatically. is there an analog of: sed 's/string1/string2/g' ? P.S. the best way is to recompile the binary files i have, but there are no sources available.

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

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

Programming :: Bash Search Line And Replace Hex To Binary?

Jul 7, 2011

I need a command to search a string in a file and then to convert the next string in the same line from hexadecimal to binary. I was able to put everything in capitals. The original file can be as such:

E 2
C 1 794
T ffff
E 2
C 1 787

It is not always FFFF! I am trying to do this in a file at once, not reading line by line (using while).

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

Programming :: Multi File Recursive Folder Search And Replace?

Aug 3, 2010

I'm wanting to mod some PHP files across a hierarchy and thought I'd drive it with find + grep + xargs

I built up a command line which I was confident would do the job, but now can't save the results.

First I tried this:

Code:
find . -name *.php | xargs grep serialize | cut -d: -f1| sort -u | xargs sed -i s/serialize/serialise/g
but that didn't work:
Code:
sed: illegal option -- i
so I thought I'd try using
Code:

[Code].....

View 10 Replies View Related

Ubuntu :: Back - Up - Forward Navigation Not Working Properly

Aug 17, 2010

I installed Ubuntu 10.04 on my systems. In the file browser or any internet browser, if I click on back, forward or up, nothing happens. I stays on the current page/location. Even if goes back, sometimes, it again comes back automatically to current page/location. I can navigate using keyboard but not with mouse.

System Configuration:
Processor: Core 2 Quad 2.5 GHz
RAM: 2 GB
Motherboard: Intel Desktop Board DG41RQ.

View 2 Replies View Related

Ubuntu :: Back And Forward Mouse Button In Opera

Jul 1, 2010

why these buttons would not work in opera but work in nautilus and firefox? I've tried to change the mouse settings in opera and nothing works. thoughts?

View 1 Replies View Related

Software :: Back And Forward Icons Missing In Firefox?

Jan 26, 2011

I'm running Sabayon Linux, and recently when through a major upgrade where a lot of packages were upgraded.

After the upgrade, when launching firefox, the back and forward icons are missing. The buttons are actually there, as I can still select an empty grey rectangle. I also checked and it's happening for all users on the system.

I was using the persona's theme, but I stopped using that (for performance reasons). I just disabled it, I haven't actually removed it.

I tried re-installing gnome-icon-theme package from a suggestion on another linuxquestions.org thread, but that didn't help.

It's not a big deal as I can still use the buttons, but curious if anyone has any insight into what I can do to get the icons back.

View 2 Replies View Related







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