Search Results

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

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

  • How to sed search and replace without changing ownership

    - by Ian
    I found this command line search and replace example: find . -type f -print0 | xargs -0 sed -i 's/find/replace/g' It worked fine except it changed the date and file ownership on EVERY file it searched through, even those that did not contain the search text. What's a better solution to this task? Thanks.

    Read the article

  • replace line with sed in csh

    - by not_a_geek
    Hello, I am trying to change the content of a specific line in a batch of files. I thought that would be a piece of cake but for some reason, nothing happens, so I guess I am missing something. Line 8 should have been replaced. Here the csh script I used: !/bin/csh # replace context in line xxx by yyy 2010/05/07 set files = ls FILENAMEPART* echo $files foreach file ($files) sed '8,8 s/1/2 /' $file end thanks for suggestions

    Read the article

  • awk or sed: Best way to grab [this text]

    - by Parand
    I'm trying to parse various info from log files, some of which is placed within square brackets. For example: Tue, 06 Nov 2007 10:04:11 INFO processor:receive: [someuserid], [somemessage] msgtype=[T] What's an elegant way to grab 'someuserid' from these lines, using sed, awk, or other unix utility?

    Read the article

  • [sed] Multiline trimming

    - by wwrob
    I have a html file that I want to trim. I want to remove a section from the beginning all the way to a given string, and from another string to the end. How do I do that, preferably using sed?

    Read the article

  • sed or greo 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 drfr4fdr4fmedmifmitfmifrtfrfrfrfnurfnurnfrunfrufnrufnrufnrufnruf"** # need to match the content of param1 as sed -n "/$param1/p" file but because the line length (very long line) I cant match the line what’s the best way to match very long lines?

    Read the article

  • sed: group capturing

    - by Michael
    Is there any way to tell sed to output only captured groups? for example given by input: This is a sample 123 text and some 987 numbers and pattern /([\d]+)/ I could get only 123 and 987 output in the way formatted by back references perhaps?

    Read the article

  • how to use sed/awk to remove words with multiple pattern count

    - by user1461112
    I have a file of string records where one of the fields - delimited by "," - can contain one or more "-" inside it. The goal is to delete the field value if it contains more than two "-". i am trying to recoup my past knowledge of sed/awk but can't make much headway ========== info,whitepaper,Data-Centers,yes-the-6-top-problems-in-your-data-center-lane info,whitepaper,Data-Centers,the-evolution-center info,whitepaper,Data-Centers,the-evolution-of-lan-technology-lanner ========== expected outcome: info,whitepaper,Data-Centers info,whitepaper,Data-Centers,the-evolution-center info,whitepaper,Data-Centers thanks

    Read the article

  • Need help with a regex (sed)

    - by nimo9367
    I want to transform a line that looks like this: any text #any text# ===#text#text#text#===# into: any text #any text# ===#texttexttext===# As you can see above I want to remove the # between ===# and ===# The number of # that are supposed to be removed can be any number. Can I do this with sed?

    Read the article

  • Converting FASTQ to FASTA with SED/AWK

    - by neversaint
    I have a data in that always comes in block of four in the following format (called FASTQ): @SRR018006.2016 GA2:6:1:20:650 length=36 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGN +SRR018006.2016 GA2:6:1:20:650 length=36 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!+! @SRR018006.19405469 GA2:6:100:1793:611 length=36 ACCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +SRR018006.19405469 GA2:6:100:1793:611 length=36 7);;).;);;/;*.2>/@@7;@77<..;)58)5/>/ Is there a simple sed/awk/bash way to convert them into this format (called FASTA): >SRR018006.2016 GA2:6:1:20:650 length=36 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGN >SRR018006.19405469 GA2:6:100:1793:611 length=36 ACCCGCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC In principle we want to extract the first two lines in each block-of-4 and replace @ with >.

    Read the article

  • Optimize grep, awk and sed shell stuff

    - by kockiren
    I try to sum the traffic of diffrent ports in the logfiles from "IPCop" so i write and command for my shell, but i think its possible to optimize the command. First a Line from my Logfile: 01/00:03:16 kernel INPUT IN=eth1 OUT= MAC=xxx SRC=xxx DST=xxx LEN=40 TOS=0x00 PREC=0x00 TTL=98 ID=256 PROTO=TCP SPT=47438 DPT=1433 WINDOW=16384 RES=0x00 SYN URGP=0 Now i grep with following Command the sum of all lengths who contains port 1433 grep 1433 log.dat|awk '{for(i=1;i<=10;i++)if($i ~ /LEN/)print $i};'|sed 's/LEN=//g;'|awk '{sum+=$1}END{print sum}' The for loop i need because the LEN-col is not on same position at all time. Any suggestion for optimizing this command? Regards Rene

    Read the article

  • awk / sed script to remove text

    - by radman
    Hi, I am currently needed of way to programmatically remove some text from Makefiles that I am dealing with. Now the problem is that (for whatever reason) the makefiles are being generated with link commands of -l<full_path_to_library>/<library_name> when they should be generated with -l<library_name>. So what I need is a script to find all occurrences of -l/ and then remove up to and including the next /. Example of what I'm dealing with -l/home/user/path/to/boost/lib/boost_filesystem I need it to be -lboost_filesystem As could be imagined this is a stop gap measure until I fix the real problem (on the generation side) but in the meantime it would be a great help to me if this could work and I am not too good with my awk and sed. Thanks for any help.

    Read the article

  • sed: search and replace string with line number

    - by tigerstyle
    Hi volks, I have a XML file with a lot of empty tag attributes. For instance: <mytag id=""> <ontent>aaa</content> </mytag> <mytag id=""> <ontent>bbb</content> </mytag> <mytag id=""> <ontent>ccc</content> </mytag> Now I want to replace id="" with e.g. id="2443" (id="[linenumber]") I tried to do this with sed, but I did not get a successful result. I hope someone here can help me :-)

    Read the article

  • Changing the contents of a file with sed in Solaris 10

    - by ubersol
    Hello, I have a bash script that I want to change all occurrences of jdk1.5.0_14 with jdk1.6.0_20 in a file I have the following piece of code : #!/bin/bash myvar="jdk1.6.0_20" sed "s/jdk1.*/$myvar/g" answer_file.1 > answer_file.2 However I have the following information in answer_file.1 (pasting the relevant part): JDKSelection.directory.JDK_LIST=/usr/jdk/jdk1.5.0_14 (v. 1.5.0_14 by Sun Microsystems Inc.) JDKSelection.directory.HIDDEN_JDK=/usr/jdk/jdk1.5.0_14 The code above changes the occurence of jdk1.5.0_14 to jdk1.6.0_20 but also removes the information contained in paranthesis in the first line. So after the change, I need the answer_file.2 file look like this: JDKSelection.directory.JDK_LIST=/usr/jdk/jdk1.6.0_20 (v. 1.6.0_20 by Sun Microsystems Inc.) JDKSelection.directory.HIDDEN_JDK=/usr/jdk/jdk1.6.0_20 How can I achieve this? Thanks for your answers....

    Read the article

  • Sed-replacing a pattern

    - by grails_enthu
    I have below code: <td nowrap="nowrap" width="74"> <p align="center">server1</p> </td> <td nowrap="nowrap" width="74"> <p align="center">server2</p> </td> and so on.I want to get output as: <td nowrap="nowrap" width="74">server1</td> <td nowrap="nowrap" width="74">server2</td> What should be my approach?Say for example the file is server.html I have done something like this: sed "s/<p align="center">*</p>/*/" -i server.html But its not working.

    Read the article

  • Removing a text block from a file : sed ?

    - by user555338
    Hi, Following an attack, I need to remove 4 lines of text added to .htaccess files in my site, and was thinking SED would be the way to go, but cannot see how in spire of many attempts. The added lines are RewriteEngine On RewriteCond %{HTTP_REFERER} ^http:// RewriteCond %{HTTP_REFERER} !%{HTTP_HOST} RewriteRule . http://targeturlhere.net/%{REMOTE_ADDR} I managed to create the script to remove added htaccess files containing those lines only, but for existing htaccess files in which that was appended I have to edit the file and cannot delete it. I cannot just remove line by line nor use "RewriteEngine On" as the start marker, as this instruction "RewriteEngine On" is sometimes legitimate elsewhere in the file. In most cases those lines are the last, but I guess in other files they could be in the middle, so I was trying to remove exactly that block - and have a script I could reuse in a similar case. (Edit: my 4 lines are below one another, no blank line in between but the editor here seems to either show no breakline, or one adding a blank line) Any hint or tip ? Thanks.

    Read the article

  • Using sed to delete string

    - by wired
    I was hacked and have hundreds of .js files with this line of code that I'm trying to get rid of: ;document.write('<iframe src="http://sitecorporatemanagement.ru/pretzellogmeins.cgi?8" scrolling="auto" frameborder="no" align="center" height="3" width="3"></iframe>'); It is the last line of the file, but I think the file contains windows line endings, because when ever I do this: sed -i '/sitecorporatemanagement.ru/d' * it deletes the full content of the file. Can you help me get this to work? I just need that full string deleted. Thank you for all the help you can give.

    Read the article

  • Find and hide file extension

    - by Daveo
    I am trying to find all files that have the same filename (excluding the file extension) that occur 3 times. I also need the full path to the file. What I have currently is #get file without extension alias lse="ls -1R | sed -e 's/\.[a-zA-Z]*$//'" #print out the current dir and get files occuring 3 times lse | sed "s;^;`pwd`/;" | sort | uniq -c | grep " 3 " This runs howver pwd prints the folder I ran the command from not the path to the file. So I tried find find . -type f | sed "s#^.#$(pwd)#" | sort | uniq -c This runs but includes the file extension. When I try to add sed -e 's/\.[a-zA-Z]*$//'" I get errors as I am not sure how to combine the two sed commands and I cannot seem to pipe a second time to sed? so what I am trying to do is find . -type f | sed "s#^.#$(pwd)#" | sed -e 's/\.[a-zA-Z]*$//'"| sort | uniq -c | grep " 3 " but this does not run.

    Read the article

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