sed + sed one command
how to perfrom sed one commmand in please to perfrom as the follwoing: | sed s'/:/ /g' | sed s'/=/ /g' for example sed s'/..../ /g' lidia ...
how to perfrom sed one commmand in please to perfrom as the follwoing: | sed s'/:/ /g' | sed s'/=/ /g' for example sed s'/..../ /g' lidia ...
hi all how to join string from the left side to the output For example (we want to join parameter="file/" remark: file=/dir1/dir2/ (file have value) echo aaa bbb | awk '{print $2}' | sed .... Will print /dir1/dir2/bbb ...
Sometime we have problem with the file PATH syntax For example Wrong PATH as (double back slash) /etc//sysconfig/network While the right syntax is /etc/sysconfig/network How to fix by sed if the PATH have two double spaces (consecutive) For example echo /etc//sysconfig/network | sed … will print /etc/syscon...
Hello, I am facing the following problem. Let's say I have a file, which contains something like this: blah blah blah blah more text <tag1>something</tag1> <tag2>something else</tag2> blah blah meh whatever foo bar What I want to do is to replace all occurrences of tag1 with tag2, and all occurences of tag2 with tag1. However, I don'...
I want to remove all the non-ASCII characters from a file in place. I found one solution with tr, but i guess I need to write back that file after modification. I need to do it in place with relatively good performance. Any suggestions? Thanks ...
I have a file with function prototypes like this: int func1(type1 arg, int x); type2 funct2(int z, char* buffer); I want to create a script (bash, sed, awk, whatever) that will print function = func1 // first argument type = type1// second argument type = int function = func1 // first argument type = int// second argument type =...
Hi i want to match 12,345 in the following string: adf99fgl12,345qsdfm34 In general case, i have a number (a price) with a comma, in a string that contains numbers, letters, and other symbols, but no other commas. I want to tell sed to extract the price, that is to say, all number before and after the comma, and the comma. The closest...
I need to delete the same line in a large number of text files. I have been trying to use sed, but I cannot get it to delete the newline character at the end. The following successfully deletes the line, but not the newline: sed -i -e 's/VERSION:1//' *.txt I have tried using the following to delete the newline also, but it does not wo...
I'm trying to use sed to fix a file, and I'm having trouble grokking what I'm doing wrong. Any pointers on why sed isn't behaving as I expect it to would be appreciated. My file consists of a bunch of lines, each containing a single value. The content of the values is irrelevant for the replacing, save that they're always alpha-numeric ...
hi how to remove comment lines (as # bal bla ) and empty lines (lines without charecters) from file with one sed command? THX lidia ...
How to replace a few matches in one line using sed? I have a file.log with text: sometext1;/somepath1/somepath_abc123/somepath3/file1.a;/somepath1/somepath_abc123/somepath3/file1.o;/somepath1/somepath_abc123/somepath3/file1.cpp; sometext2;/somepath1/somepath_abc123/somepath3/file2.a;/somepath/somepath_abc123/somepath3/file2.o;/somepat...
I would like to convert a text file containing words, space separate to a file where each word appears on a separate line sdf sdfsd= sdfsdf sdfsdf will become sdf sdfsd= sdfsdf sdfsdf thanks ...
Hi I have a file that is just one line (one HUGE line) to parse. I want to parse out the value that appears between "Undefined error code" and " id" on this line. The thing is this appears multiple times on the same line with different values everywhere. The following code only gives me the last instance. cat bad_events_P2J3.xml | sed...
I have an input C file (myfile.c) that looks like this : void func_foo(); void func_bar(); //supercrazytag I want to use a shell command to insert new function prototypes, such that the output becomes: void func_foo(); void func_bar(); void func_new(); //supercrazytag So far I've been unsuccessful using SED or PERL. What didn't w...
Excuse me if it is a repeat. I have crontab entries which look like: * * * * * sleep 15;/etc/opt/wer.sh 1 * * * * /opt/sfm/qwe/as.sh How to insert a # on the line which contains a call to "as.sh" using sed? How to uncomment it back? ...
I have a file with a string on each line... ie. test.434 test.4343 test.4343t34 test^tests.344 test^34534/test I want to find any line containing a "^" and replace entire line with a blank. I was trying to use sed: sed -e '/\^/s/*//g' test.file This does not seem to work, any suggestions? ...
Hello all, I have a file that uses the pipe character as a separator since I assumed that most of my clients wouldn't use the pipe character in their data. Apparently I was wrong, but I compensated for this by specifying that any fields using the pipe character need to be wrapped in double quotes. Unfortunately, they haven't done this, ...
I'm trying something new, I would normally do this in C# or VB. But for speed reason I'd like to do this on my server. Open File terms.txt Take each item one at a time from terms.txt and open a url (possibly curl or something else) and go to http://system.com/set=terms View the HTML source and extract pic names (stringB). Look for ima...
I have a text file, !--- Marker one --! aaaa bbbb cccc dddd !--- Marker two --! eeee ffff !--- Marker three --! gggg hhhh iiii And I need to copy from Marker two (till the end of Marker two) into a new file, using Bash. !--- Marker two --! eeee ffff Becomes a separate file. ...
hi! i have a proxy config file which has the following line: Allow 212.21.3.44 i'd like to replace that ip address portion with my new ip address when it changes. it would probably be easier to just use the line number when searching for it - i don't think that config file will change at all other than that particular setting. how c...