Search Results

Search found 720 results on 29 pages for 'sed'.

Page 2/29 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Using sed to Download ComboFix automatically

    - by user901398
    I'm trying to write a shell script to grab the dynamic URL which ComboFix is located at at BleepingComputer.com/download/combofix However, for some reason I can't seem to get my regex to match the download link of the "click here" if the download doesn't work. I used a regex tester and it said I matched the link, but I can't seem to get it to work when I execute it, it turns up an empty result. Here's my entire script: #!/bin/bash # Download latest ComboFix from BleepingComputer wget -O Listing.html "http://www.bleepingcomputer.com/download/combofix/" -nv downloadpage=$(sed -ne 's@^.*<a href="\(http://www[.]bleepingcomputer[.]com/download/combofix/dl/[0-9]\+/\)" class="goodurl">.*$@\1@p' Listing.html) echo "DL Page: $downloadpage" secondpage="$downloadpage" wget -O Download.html $secondpage -nv file=$(sed -ne 's@^.*<a href="\(http://download[.]bleepingcomputer[.]com/dl/[0-9A-Fa-f]\+/[0-9A-Fa-f]\+/windows/security/anti[-]virus/c/combofix/ComboFix[.]exe\)">.*$@\1@p' Download.html) echo "File: $file" wget -O "ComboFix.exe" "$file" -nv rm Listing.html rm Download.html mkdir Tools mv "ComboFix.exe" "Tools/ComboFix.exe" -f The first two downloads work successfully, and I end up with: http://www.bleepingcomputer.com/download/combofix/dl/12/ But it fails to match the final sed that will give me the download link. The code it's supposed to match is: <a href="http://download.bleepingcomputer.com/dl/6c497ccbaff8226ec84c97dcdfc3ce9a/5058d931/windows/security/anti-virus/c/combofix/ComboFix.exe">click here</a>

    Read the article

  • using sed to print next line after match

    - by smokinguns
    I came across various examples on printing next line after a match, that use awk and sed. I'm using it in my code and it works fine. Now I want to use a variable instead of a hardcoded value for the pattern match. The search pattern string includes forward slashes "/". How do I use a variable that has "/" in it and use it to print the next line after the match? The following doesn't seem to work: var="/somePath/to/my/home" val=`echo -e "$someStr" | sed -n ':$var:{n;p;}'` In this case, val is always blank. I'm using using ":" as the delimiter instead of "/". I'm on a Mac OS X.

    Read the article

  • Using sed to convert hex characters in postgresql dump file

    - by Bernt
    I am working on moving several databases from a Postgresql 8.3 server to a Postgresql 8.4 server. It has worked fine so far, but one base has given me some trouble. The database is listed as unicode-encoded in the 8.3-server, but somehow a client program has managed to inject some invalid unicode data into it. When I do a normal dump and restore using postgres' custom format, the new server won't accept it, complaining about unicode errors. My plan is to do a plain text dump of the database, then use sed to replace the invalid characters with nothing (they are not needed). But how do you make sed work on hex/binary values in a file?

    Read the article

  • Passing the output of the last command to sed as an argument

    - by neurolysis
    Hi, Basically, I'm wanting to automate adding something to xorg.conf in the right place, I've used some commands to get the line number of the line I want to manipulate, but I'm not really sure how to go about passing this line number (as an argument and NOT something to be manipulated) to sed. I have been told about xargs and looked at the docs on it, but after some reading and experimentation I can't seem to get it to work. In case anyone can think of a better method entirely, the process I want to automate is just finding the line containing both "Identifier" and "Monitor0" (there will only be one) and adding a line below it. The problem with just finding Monitor0 and manipulating that line is that there are multiple lines with Monitor0 in. I've got this far: fgrep -n "Monitor0" </etc/X11/xorg.conf | fgrep "Identifier" | cut -f1 -d: This gives out the line number which I'm wanting to pass to sed, but I'm not really sure how to do it. ...or is there a simpler way which I'm not seeing? Thanks. :)

    Read the article

  • split a textfile after each n matches to a new file using sed or awk

    - by ozz
    i tried to split a file in parts of n matches each. The file is just one line and the seperator is '<br>' foo<br>bar<br>.....<br> I just want to split the file in parts, where each file has 100 datasets (text plus <br>)( normaly 100 datasets, but at the end maybe less) I already played around with this ... split-file-in-2-with-sed and this split-one-file-into-multiple-files-based-on-pattern sed.exe -e "^.*.<br>{0,100}/g" < original.txt > first_half.txt The split do not work an the result is only 1 file instead of many.

    Read the article

  • using sed to replace two patterns within a larger pattern

    - by Hair of the Dog
    Using sed how could I replace two patterns within a larger pattern on a single line? Given a single line of text I want to find a pattern (Let's call this the outer pattern) and then within that outer pattern replace two inner patterns. Here's a one line example of the input text: Z:\source\private\main\developer\foo\setenv.sh(25): export 'FONTCONFIG_PATH'="$WINE_SHARED_SUPPORT/X11/etc/fonts" In the example above the outer pattern is "/^.*([[:digit:]]+):/" which should equal "Z:\source\private\main\developer\foo\setenv.sh(25):" The two inner patterns are "/^[A-Za-z]:/" and "/\/". Another way to phrase my question is: Using sed I know how to perform replacements of a pattern using the "s" command, but how do I limit the range of "s" command so it only works on the portion of the input string up to the "(25):"? The ultimate result I am trying to get is the line of text is transformed into this: /enlistments/source/private/main/developer/foo/setenv.sh(25): export 'FONTCONFIG_PATH'="$WINE_SHARED_SUPPORT/X11/etc/fonts"

    Read the article

  • Is \d equal to [0-9] in sed?

    - by user3872279
    7 00:00:30,008 --> 00:00:30,066 by line 8 00:00:31,038 --> 00:00:34,050 or later in the nineteen seventies it was usually a 9 00:00:34,005 --> 00:00:38,634^M video consul but the council was not capable of displaying arbitrate graphics 10 The above lines is in a file named 2.txt. I wanna the lines which doesn't start with number. In practice, sed -i '/^[0-9]+/d' 2.txt works good. However, sed -i '/^\d+/d' 2.txt doesnot. The \d shouldn't be equal to [0-9] in regex?

    Read the article

  • Sed does not work in expect

    - by Sharjeel Sayed
    I made this bash one-liner which I use to list Weblogic instances running along with their full paths.This works well when I run it from the shell. /usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print $2}' | sed 's/weblogic.policy//' | sed 's/security\///' | sort I tried to incorporate this in an expect script send "echo Weblogic Processes: ; /usr/ucb/ps auwwx | grep weblogic | tr ' ' '\n' | grep security.policy | grep domain | awk -F'=' '{print \$2}' | sed 's/weblogic.policy//' | sed 's/security\///' | sort ; echo ; echo\r" but I got this error sed: -e expression #1, char 13: unknown option to `s' Please help

    Read the article

  • Sed substitution not doing what I want and think it should do

    - by nategoose
    I have am trying to use sed to get some info that is encoded within the path of a file which is passed as a parameter to my script (Bourne sh, if it matters). From this example path, I'd like the result to be 8 PATH=/foo/bar/baz/1-1.8/sing/song I first got the regex close by using sed as grep: echo $PATH | sed -n -e "/^.*\/1-1\.\([0-9][0-9]*\).*/p" This properly recognized the string, so I edited it to make a substitution out of it: echo $PATH | sed -n -e "s/^.*\/1-1\.\([0-9][0-9]*\).*/\1/" But this doesn't produce any output. I know I'm just not seeing something simple, but would really appreciate any ideas about what I'm doing wrong or about other ways to debug sed regular expressions.

    Read the article

  • Replacing the end of the line by SED in makefile

    - by Masi
    How can you append to the end of a line by SED controlled by makefile? I run paste -d" " t.tex tE.tex | sed 's@$@XXX@' > tM.tex where the problem is in the use of the mark $ for the end of the line. I get #paste -d" " t.tex tE.tex | sed -e s/" "/\\\&/g | sed -r "s/XXX/" > tM.tex sed: -e expression #1, char 10: unterminated `s' command make: *** [all] Error 1 I have the command just after the "all:" tag in my makefile which contains only the two lines. The parameters -n and -e do not help here. The command works as expected run when it is run directly in terminal.

    Read the article

  • Sed: Deleting all content matching a pattern

    - by Svish
    I have some plist files on mac os x that I would like to shrink. They have a lot of <dict> with <key> and values. One of these keys is a thumbnail which has a <data> value with base64 encoded binary (I think). I would like to remove this key and value. I was thinking this could maybe be done by sed, but I don't really know how to use it and it seems like sed only works on a line-by-line basis? Either way I was hoping someone could help me out. In the file I would like to delete everything that matches the following pattern or something close to that: <key>Thumbnail<\/key>[^<]*<\/data> In the file it looks like this: // Other keys and values <key>Thumbnail</key> <data> TU0AKgAAOEi25Pqx3/ip2fak0vOdzPCVxu2RweuPv+mLu+mIt+aGtuaEtOSB ... dCBBcHBsZSBDb21wdXRlciwgSW5jLiwgMjAwNQAAAAA= </data> // Other keys and values Anyone know how I could do this? Also, if there are any better tools that I can use in the terminal to do this, I would like to know about that as well :)

    Read the article

  • sed: delete text between a string until first occurrence of another string

    - by Marit Hoen
    Imagine I have something like the following text: The quick brown fox jumps in 2012 and 2013 And I would wish to delete the part from "fox" including the four numbers but only in the first occurrence so I end up with: The quick brown and 2013 Something likes this...: echo "The quick brown fox jumps in 2012 and 2013" \ | sed "s/fox.*\([0-9]\{4\}\)//g" ...brings me: The quick brown So it removed everything including the last occurrence of the four numbers. Any ideas?

    Read the article

  • Use sed command to replace , appearing between numbers

    - by Saurabh
    I have a CSV file where data are in the following format |001|,|abc,def|,123456,789,|aaa|,|bbb|,444,555,666 I want to replace only those "," that appears between numbers with some other character like say SOH or $ or * other "," appearing in the line should not get replaced i.e. to say I wish to have following output |001|,|abc,def|,123456*789,|aaa|,|bbb|,444*555*666 Can someone please help me with sed command pattern to get the above desired output

    Read the article

  • grep + sed for find & replace fun!

    - by Jim Greenleaf
    I have a dev copy of a website set up that has quite a few hardcoded references to its live counterpart. I would like to replace all occurrences of "www." with "dev." in all files. I think I can use a combination of grep + sed, but I'm not sure how.

    Read the article

  • sed or grep or awk to match very very long lines

    - by yael
    more file param1=" 1,deerfntjefnerjfntrjgntrjnvgrvgrtbvggfrjbntr*rfr4fv*frfftrjgtrignmtignmtyightygjn 2,3,4,5,6,7,8, rfcmckmfdkckemdio8u548384omxc,mor0ckofcmineucfhcbdjcnedjcnywedpeodl40fcrcmkedmrikmckffmcrffmrfrifmtrifmrifvysdfn" need to match the content of $param1 in the file but its not work for example sed -n "/$param1/p" file or any grep $param1 file etc... any other solutions? maybe with perl?

    Read the article

  • remove white space before delimiter with sed

    - by Erik
    I have data of the following format that I want to input into LibreOffice calc data | num | num | num | num For some reason Libreoffice does not think the string "3214 " is a number by default (trailing white space). I want to replace '(\s)*|' with '|' where \s stands for space and * for the Kleene star operation. And do this at multiple places in each line (all matches). I tried: sed -i 's/(\s)*|/|/' DataStats0914.txt But it has no effect.

    Read the article

  • sed/awk or other: one-liner to increment a number by 1 keeping spacing characters

    - by WizardOfOdds
    EDIT: I don't know in advance at which "column" my digits are going to be and I'd like to have a one-liner. Apparently sed doesn't do arithmetic, so maybe a one-liner solution based on awk? I've got a string: (notice the spacing) eh oh 37 and I want it to become: eh oh 36 (so I want to keep the spacing) Using awk I don't find how to do it, so far I have: echo "eh oh 37" | awk '$3>=0&&$3<=99 {$3--} {print}' But this gives: eh oh 36 (the spacing characters where lost, because the field separator is ' ') Is there a way to ask awk something like "print the output using the exact same field separators as the input had"? Then I tried yet something else, using awk's sub(..,..) method: ' sub(/[0-9][0-9]/, ...) {print}' but no cigar yet: I don't know how to reference the regexp and do arithmetic on it in the second argument (which I left with '...' for now). Then I tried with sed, but got stuck after this: echo "eh oh 37" | sed -e 's/\([0-9][0-9]\)/.../' Can I do arithmetic from sed using a reference to the matching digits and have the output not modify the number of spacing characters? Note that it's related to my question concerning Emacs and how to apply this to some (big) Emacs region (using a replace region with Emacs's shell-command-on-region) but it's not an identical question: this one is specifically about how to "keep spaces" when working with awk/sed/etc.

    Read the article

  • Using sed for introducing newline after each > in a +1 gigabyte large one-line text file

    - by wasatz
    I have a giant text file (about 1,5 gigabyte) with xml data in it. All text in the file is on a single line, and attempting to open it in any text editor (even the ones mentioned in this thread: http://stackoverflow.com/questions/159521/text-editor-to-open-big-giant-huge-large-text-files ) either fails horribly or is totally unusable due to the text editor hanging when attempting to scroll. I was hoping to introduce newlines into the file by using the following sed command sed 's/>/>\n/g' data.xml > data_with_newlines.xml Sadly, this caused sed to give me a segmentation fault. From what I understand, sed reads the file line-by-line which would in this case mean that it attempts to read the entire 1,5 gig file in one line which would most certainly explain the segfault. However, the problem remains. How do I introduce newlines after each in the xml file? Do I have to resort to writing a small program to do this for me by reading the file character-by-character?

    Read the article

  • sed/awk or other: increment a number by 1 keeping spacing characters

    - by WizardOfOdds
    I've got a string: (notice the spacing) eh oh 37 and I want it to become: eh oh 36 (so I want to keep the spacing) Using awk I don't find how to do it, so far I have: echo "eh oh 37" | awk '$3>=0&&$3<=99 {$3--} {print}' But this gives: eh oh 36 (the spacing characters where lost, because the field separator is ' ') Is there a way to ask awk something like "print the output using the exact same field separators as the input had"? Then I tried with sed, but got stuck after this: echo "eh oh 37" | sed -e 's/\([0-9][0-9]\)/.../' Can I do arithmetic from sed using a reference to the matching digits and have the output not modify the number of spacing characters? Note that it's related to my question concerning Emacs and how to apply this to some (big) Emacs region (using a replace region with Emacs's shell-command-on-region) but it's not an identical question: this one is specifically about how to "keep spaces" when working with awk/sed/etc.

    Read the article

  • [bash] Escape a string for sed search pattern

    - by Alexander Gladysh
    In my bash script I have an external (received from user) string, which I should use in sed pattern. REPLACE="<funny characters here>" sed "s/KEYWORD/$REPLACE/g" How can I escape the $REPLACE string so it would be safely accepted by sed as a literal replacement? NOTE: The KEYWORD is a dumb substring with no matches etc. It is not supplied by user.

    Read the article

  • Sed non greedy curly braces match

    - by Cesar
    I have a string in a file a.txt {moslate}alho{/moslate}otra{moslate}a{/moslate} a need to get the string otra using sed. With this regex sed 's|{moslate}.*{/moslate}||g' a.txt a get no output at all but when i add a ? to the regex s|{moslate}.*?{/moslate}||g a.txt (I've read somewhere that it makes the regex non-greedy) i get no match at all, i mean a get the following output {moslate}alho{/moslate}otra{moslate}a{/moslate} How can i get the required output using sed?

    Read the article

  • sed multiline pygmentize

    - by dasickis
    I would like to take the html piece and pass it to pygmentize to colorize it accordingly. I'm wondering how I could use sed or some other cli tool to get that accomplished. I tried a bunch of sed one-liners and tried to use the following SO questions: Sed multiline replacement question Using or in multiline sed replacement sed or awk multiline replace I have the following log: 2012-03-26 18:04:27,385 9372 [main] ERROR web.commons.exception.ServiceInvocationException - Response from server cannot be decoded to JSON, responsePayload = <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404</h2> <p>Problem accessing jetty-url. Reason: <pre> Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> </body> </html> org.codehaus.jackson.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.StringReader@369133f6; line: 1, column: 2] UPDATE I'm adding this to a longer command: mvn -U test | (while read line; do echo ${line} | sed -e "s/.*ERROR.*/`echo -e '\e[91m&\e[0m'`/g" -e "s/.*\(WARN|INFO\).*/`echo -e '\e[93m&\e[0m'`/g"; done)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >