Search Results

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

Page 11/29 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Regular Expression: back references

    - by sixtyfootersdude
    sed 's/^\(\h*\)\(.*\)$/\1<!-- \2 -->/' web.xml I think that this should take this xml: <a> <d> bla </d> </a> And turn it into: <!-- <a> --> <!-- <d> --> <!-- bla --> <!-- </d> --> <!-- </a> --> But what is doing is this: <!-- <a> --> <!-- <d> --> <!-- bla --> <!-- </d> --> <!-- </a> -->

    Read the article

  • Creating multiple csv files from data within a csv file.

    - by S1syphus
    System OSX or Linux I'm trying to automate my work flow at work, each week I receive an excel file, which I convert to a csv. An example is: ,,L1,,,L2,,,L3,,,L4,,,L5,,,L6,,,L7,,,L8,,,L9,,,L10,,,L11, Title,r/t,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,neede d,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst,needed,actual,Inst EXAMPLEfoo,60,6,6,6,0,0,0,0,0,0,6,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 EXAMPLEbar,30,6,6,12,6,7,14,6,6,12,6,6,12,6,8,16,6,7,14,6,7.5,15,6,6,12,6,8,16,6,0,0,6,7,14 EXAMPLE1,60,3,3,3,3,5,5,3,4,4,3,3,3,3,6,6,3,4,4,3,3,3,3,4,4,3,8,8,3,0,0,3,4,4 EXAMPLE2,120,6,6,3,0,0,0,6,8,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 EXAMPLE3,60,6,6,6,6,8,8,6,6,6,6,6,6,0,0,0,0,0,0,6,8,8,6,6,6,0,0,0,0,0,0,0,10,10 EXAMPLE4,30,6,6,12,6,7,14,6,6,12,6,6,12,3,5.5,11,6,7.5,15,6,6,12,6,0,0,6,9,18,6,0,0,6,6.5,13 And so you can get a picture of how it looks in excel: What I need to do, is create multiple csv files for each instance in row 1, so L1, L2, L3, L4... And within that each csv file it needs to contain the title, r/t, needed So for L1 an example out put would look like: EXAMPLEfoo,60,6 EXAMPLEbar,30,6 EXAMPLE1,60,3 EXAMPLE2,120,6 EXAMPLE3,60,6 EXAMPLE4,30,6 And for L2: EXAMPLEfoo,60,0 EXAMPLEbar,30,6 EXAMPLE1,60,3 EXAMPLE2,120,0 EXAMPLE3,60,6 EXAMPLE4,30,6 And so on. I have tried playing around with sed and awk and hit google but I have found nothing that really solves the issue. I'd imagine perl would be particular suited to this or maybe python, so I would be more than happy to accept suggestions from users. So, any suggestions? Thanks in advance.

    Read the article

  • Bash script to insert code from one file at a specific location in another file?

    - by Kurtosis
    I have a fileA with a snippet of code, and I need a script to insert that snippet into fileB on the line after a specific pattern. I'm trying to make the accepted answer in this thread work, but it's not, and is not giving an error so not sure why not: sed -e '/pattern/r text2insert' filewithpattern Any suggestions? pattern (insert snippet on line after): def boot { also tried escaped pattern but no luck: def\ boot\ { def\ boot\ \{ fileA snippet: LiftRules.htmlProperties.default.set((r: Req) => new Html5Properties(r.userAgent)) fileB (Boot.scala): package bootstrap.liftweb import net.liftweb._ import util._ import Helpers._ import common._ import http._ import sitemap._ import Loc._ /** * A class that's instantiated early and run. It allows the application * to modify lift's environment */ class Boot { def boot { // where to search snippet LiftRules.addToPackages("code") // Build SiteMap val entries = List( Menu.i("Home") / "index", // the simple way to declare a menu // more complex because this menu allows anything in the // /static path to be visible Menu(Loc("Static", Link(List("static"), true, "/static/index"), "Static Content"))) // set the sitemap. Note if you don't want access control for // each page, just comment this line out. LiftRules.setSiteMap(SiteMap(entries:_*)) // Use jQuery 1.4 LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQuery14Artifacts //Show the spinny image when an Ajax call starts LiftRules.ajaxStart = Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) // Make the spinny image go away when it ends LiftRules.ajaxEnd = Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd) // Force the request to be UTF-8 LiftRules.early.append(_.setCharacterEncoding("UTF-8")) } }

    Read the article

  • Unix: cannot add "\\ \n" even with escaping to the end of line

    - by HH
    I try to convert clean columnwise data to tables in tex. I am unable to have "\ \n" at each end of line. Please, see the command at the end. Data $ echo `. ./bin/addTableTexTags.sh < .data_3` 10.31 & 8.50 & 7.40 10.34 & 8.53 & 7.81 8.22 & 8.62 & 7.78 10.16 & 8.53 & 7.44 10.41 & 8.38 & 7.63 10.38 & 8.57 & 8.03 10.13 & 8.66 & 7.41 8.50 & 8.60 & 7.15 10.41 & 8.63 & 7.21 8.53 & 8.53 & 7.12 $ cat .data_3 10.31 8.50 7.40 10.34 8.53 7.81 8.22 8.62 7.78 10.16 8.53 7.44 10.41 8.38 7.63 10.38 8.57 8.03 10.13 8.66 7.41 8.50 8.60 7.15 10.41 8.63 7.21 8.53 8.53 7.12 addTableTexTags.sh #!/bin/bash sed -e "s@[[:space:]]@\t\&\t@g" -e "s@[[:space:]]*&*[[:space:]]*\$@\t \\ \\\\n@g" // Tried Escaping "\\" with "/" here and there // but cannot get a line ending with "\\ \n".

    Read the article

  • unnecessary vertical scrollbar in ie6

    - by tirso
    hi to all does any could help me how to remove unnecessary scroll bar in ie6. I have already put overflow-y: hidden; but still the same output. thanks in advance here is my url http://webberzsoft.com/clients/csslayouttest/template_new.php here is my css * {margin:0;padding:0;}/*for demo purposes only, use a proper reset in your final layout*/ html,body { overflow: auto; height:100%; } body { font-size:100%; background:#777; } #wrapper{ min-height:99%; width: 1240px; margin:0 auto; background: #FFFFFF; border-left:1px solid #000; border-right:1px solid #000; } #header { background:#77F; border-bottom:1px solid #000; height: 70px; } #content{/*just to create top padding without tampering with min-height:100% on #inner*/ padding:10px 0; overflow:hidden;/*contain floats*/ } #left-index { float:left; width:220px; } #right-index { float:right; width:180px; } #middle-index { float:left; width:840px; overflow:hidden;/*contain floats*/ } #left-home { float:left; width:300px; } #right-home { float:right; width:940px; } here is my html <div id="wrapper"> <div id="header"> <h1 align="right">Fixed Header</h1> <h3>IE6 gets an expression</h3> </div> <div id="content"> <div id="left-index"> <h3>Left</h3> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> </div> <div id="middle-index"> <h3>Middle</h3> <p>Lorem ipsum sed pede non adipiscing nulla lacinia ipsum quis ac Integer. Ut consectetuer Cras fringilla Ut non gravida morbi Maecenas semper vel. Vestibulum quis In Nulla Vivamus Sed feugiat Quisque et ipsum tincidunt. Semper vitae cursus metus risus enim gravida tellus id dignissim nec. Justo laoreet dui commodo Integer malesuada vel quis vel consequat metus. Nec id dolor Aliquam Nullam gravida libero montes nunc ante Nulla. Tortor id.</p> <p>Lorem ipsum sed pede non adipiscing nulla lacinia ipsum quis ac Integer. Ut consectetuer Cras fringilla Ut non gravida morbi Maecenas semper vel. Vestibulum quis In Nulla Vivamus Sed feugiat Quisque et ipsum tincidunt. Semper vitae cursus metus risus enim gravida tellus id dignissim nec. Justo laoreet dui commodo Integer malesuada vel quis vel consequat metus. Nec id dolor Aliquam Nullam gravida libero montes nunc ante Nulla. Tortor id.</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> <p class="lgmarg">testing text for scrolling</p> </div> <div id="right-index"> <h3>Right</h3> <p>Lorem ipsum dolor sit amet consectetuer quis tempus tristique facilisi Vestibulum. Gravida rhoncus orci leo neque mattis felis Sed et tincidunt tellus. Massa ac condimentum elit ridiculus eget urna wisi id Suspendisse ullamcorper.</p> <p>Hendrerit eros ridiculus urna ipsum leo a ac sed tortor nisl. Tincidunt Morbi justo dis odio sit non sapien enim a augue. Sapien odio dui est Sed nisl id id malesuada sagittis et.</p> </div> </div><!--end content--> </div>

    Read the article

  • How to run sed on over 10 million files in a directory?

    - by Sandro
    I have a directory that has 10144911 files in it. So far I've tried the following: for f in ls; do sed -i -e 's/blah/blee/g' $f; done Crashed my shell, the ls is in a tilda but i can't figure out how to make one. ls | xargs -0 sed -i -e 's/blah/blee/g' Too many args for sed find . -name "*.txt" -exec sed -i -e 's/blah/blee/g' {} \; Couldn't fork any more no more memory Any other ideas on how to create this kind command? The files don't need to communicate with each other. ls | wc -l seems to work (very slow) so it must be possible.

    Read the article

  • perl and sed how to combine if and unless in perl

    - by yael
    I have the two perl command perl -pe "s/\b$a\b/$b/g if m/param1 /" test and perl -pe "s/\b$a\b/$b/g unless /^#/" test how to use combine the if m/somthing/ and the unless /something/ for example [root@localhost tmp]# perl -pe "s/\b$a\b/$b/g if m/param1/ unless /^#/" test syntax error at -e line 1, near "m/param1/ unless" but its now work THX

    Read the article

  • awk and cat - How to ignore multiple lines?

    - by Filipe YaBa Polido
    I need to extract Voip log from a D-Link router, so I've setup a little python script that executes a command in this router via telnet. My script does a "cat /var/log/calls.log" and returns the result, however... it also sends non-important stuff, like the BusyBox banner, etc... How can I ignore lines from 1 to 6 and the last 2 ? This is my current output: yaba@foobar:/stuff$ python calls.py BusyBox v1.00 (2009.04.09-11:17+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. DVA-G3170i/PT # cat /var/call.log 1 ,1294620563,2 ,+351xxx080806 ,xxx530802 ,1 ,3 ,1 DVA-G3170i/PT # exit And I just need: 1 ,1294620563,2 ,+351xxx080806 ,xxx530802 ,1 ,3 ,1 (it can have multiple lines) So that I can save it to a CSV and later to a sql db. Thanks, and sorry my bad english.

    Read the article

  • Combining multiple lines into one line

    - by mkal
    I have this use case of an xml file with input like Input: <abc a="1"> <val>0.25</val> </abc> <abc a="2"> <val>0.25</val> </abc> <abc a="3"> <val>0.35</val> </abc> ... Output: <abc a="1"><val>0.25</val></abc> <abc a="2"><val>0.25</val></abc> <abc a="3"><val>0.35</val></abc> I have around 200K lines in a file in the Input format, how can I quickly convert this into output format.

    Read the article

  • sed regex to match ['', 'WR' or 'RN'] + 2-4 digits

    - by Karl
    Hi I'm trying to do some conditional text processing on Unix and struggling with the syntax. I want to acheive Find the first 2, 3 or 4 digits in the string if 2 characters before the found digits are 'WR' (could also be lower case) Variable = the string we've found (e.g. WR1234) Type = "work request" else if 2 characters before the found digits are 'RN' (could also be lower case) Variable = the string we've found (e.g. RN1234) Type = "release note" else Variable = "WR" + the string we've found (Prepend 'WR' to the digits) Type = "Work request" fi fi I'm doing this in a Bash shell on Red Hat Enterprise Linux Server release 5.5 (Tikanga) Thanks in advance, Karl

    Read the article

  • using Awk inside Perl script

    - by papoyan
    My first question in stackoverflow! I'm having trouble using the following code inside my perl script, any advise is really appreciated, how to correct the syntax? # If I execute in bash, it's working just fine bash$ whois google.com | egrep "\w+([._-]\w)*@\w+([._-]\w)*\.\w{2,4}" |awk ' {for (i=1;i<=NF;i++) {if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) { print $i}}}'|head -n1 [email protected] #----------------------------------- #but this doesn't work bash$ ./email.pl google.com awk: {for (i=1;i<=NF;i++) {if ( ~ /[[:alpha:]]@[[:alpha:]]/ ) { print }}} awk: ^ syntax error # Here is my script bash$ cat email.pl ####\#!/usr/bin/perl $input = lc shift @ARGV; $host = $input; my $email = `whois $host | egrep "\w+([._-]\w)*@\w+([._-]\w)*\.\w{2,4}" |awk ' {for (i=1;i<=NF;i++) {if ( $i ~ /[[:alpha:]]@[[:alpha:]]/ ) { print $i}}}'|head -1`; print my $email; bash$ Thank you in advance !

    Read the article

  • replace a text string

    - by shantanuo
    I want to replace the date found at the end of the "datadir" line with the current date. For e.g. my my.cnf file looks like this... # head /etc/my.cnf [mysqld] #mount -t tmpfs -o size=102m tmpfs /mnt #datadir=/mnt read-only datadir=/mysqlApr5 #datadir=/mysqlApr2 #datadir=/mysqlMar16 #datadir=/mysqlFeb25a Most of the lines are commented. I need to find the datadir line that is not commented and then replace the /mysqlApr4 with /mysqlApr20 datadir=/mysqlApr20 If it is possible I will like to comment the older datadir path. #datadir=/mysqlApr5 I can output the current date as: date '+%b%d' But I want to concat it with the word "/mysql" and replace or comment the current datadir line.

    Read the article

  • How can I extract all quotations in a text?

    - by secr
    I'm looking for a SimpleGrepSedPerlOrPythonOneLiner that outputs all quotations in a text. Example 1: echo “HAL,” noted Frank, “said that everything was going extremely well.” | SimpleGrepSedPerlOrPythonOneLiner stdout: "HAL," "said that everything was going extremely well.” Example 2: cat MicrosoftWindowsXPEula.txt | SimpleGrepSedPerlOrPythonOneLiner stdout: "EULA" "Software" "Workstation Computer" "Device" "DRM" etc. (link to the corresponding text).

    Read the article

  • replace the line to add some text

    - by shantanuo
    The MySQL dump backup file has the following line... # head -40 backup20-Apr-2010-07-32.sql | grep 'CHANGE MASTER TO ' -- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000068', MASTER_LOG_POS=176357756; a) I need to complete the statement with the parameters like Master host, user and password. b) I do also need to remove the comment "--" The line should look something like this... CHANGE MASTER TO MASTER_HOST='111.222.333.444', MASTER_USER='slave_user', MASTER_PASSWORD='slave_user', MASTER_LOG_FILE='mysql-bin.000068', MASTER_LOG_POS=176357756;

    Read the article

  • how to find the last instance of a setting in a config file

    - by Glenn Kelley
    I am trying to figure out how to find the last entry of a string in multiple config files across a server. Each of the strings will be in the /home/***usernamewouldbehere/public_html/typo3conf/localconf.php file In short - the last entry in the config files will point to the database server the application is utilizing - and we need to know which accounts point to which db server. While I can run something like this - grep "$_db_host" /home/*/public_html/conf/localconf.php It does not really help much because it gives us way to much information ... and not what we really need. What i really need to know is the last entry of this string $_db_host = 'xx'; and to sort them out in an export file Since the config files may have multiple entries (example below) $_db_host = 'localhost'; $_db_host = '10.0.1.234'; It would be great to list in a file all of those that have the entry for 'localhost' and then list all of those that have the entry for '10.0.1.234' (or whichever server there may be there) but even if I need to do that manually that would be great. I am not sure how to get to it using Awk - ... and really stuck What I am hoping for is something that would be piped as follows db_host = localhost /home/username1/www/conf/localconf.php db_host = localhost / home/username2/public_html/conf/localconf.php db_host= '10.1.2.23' /home/username55/public_html/conf/localconf.php hoping that helps you help me :-)

    Read the article

  • awk/sed/bash to merge data

    - by Kyle
    Trying to merge some data that I have. The input would look like so: foo bar foo baz boo abc def abc ghi And I would like the output to look like: foo bar baz boo abc def ghi I have some ideas using some arrays in a shell script, but I was looking for a more elegant or quicker solution.

    Read the article

  • Pattern Matching in Columns

    - by Chronicles
    File 1 A11;F1;BMW A23;F2;BMW B12;F3;BMW H11;F4;JBW File 2 P01;A1;0;0--00 ;123;456;150 P01;A11;0;0--00 ;123;444;208 P01;B12;0;0--00 ;123;111;36 P01;V11;0;0--00 ;123;787;33.9 Output -;-;-;P01;A1;0;0--00 ;123;456;150 A11;F1;BMW;P01;A11;0;0--00 ;123;444;208 B12;F3;BMW;P01;B12;0;0--00 ;123;111;36 -;-;-;P01;V11;0;0--00 ;123;787;33.9 I TRIED awk 'FNR==NR {a[$2] = $0; next }{ if($1 in a) {p=$1;$1="";print a[p],$0}}' File1 File2 But didnt work. Basically I want to get the details from FILE 1 and compare with FILE2 (master list) . Example : A1 in FILE2 was not available in FILE1 , so in output file we have “-“ for 1st three fields and rest from FILE2 . Now, we have A11 and we got the detail in FILE1. So we write details of A11 from both File 1 & 2

    Read the article

  • Change Number Format

    - by gsembilan
    I have a lot lines contains XXXXXXXXX number format. I want change number XXXXXXXXX to XX.XXX.XXX.X XXXXXXXXX = 9 digit random number Anyone can help me? Thanks in advance

    Read the article

  • How can I replace a line which contains only -------- by |||

    - by mimou
    I have something like: ------------------------------------------------------------------------ r2 | username | 2011-01-16 16:52:23 +0100 (Sun, 16 Jan 2011) | 1 line Changed paths: D /foo Removed foo ------------------------------------------------------------------------ r1 | username | 2011-01-16 16:51:03 +0100 (Sun, 16 Jan 2011) | 1 line Changed paths: A /foo created foo ------------------------------------------------------------------------ My target is to identify the file added by the "username" in a specific date. Thus, I need to have the combination (username, 16 Jan 2011, A) to insure that it is the right file ands then print foo. My idea is to: delete the white spaces change the newlines into | get rid of the --------------- and replace them with newlines but the problem is that I couldn't replace the ------- since they are mixed with other characters. ------------------------------------------------------------------------ |r2|username|2011-01-1616:52:23+0100(Sun,16Jan2011)|1line|Changedpaths:|D/foo|Removedfoo| ------------------------------------------------------------------------ |r1|username|2011-01-1616:51:03+0100(Sun,16Jan2011)|1line|Changedpaths:|A/foo|createdfoo| ------------------------------------------------------------------------ So I thought it would be a good idea to start by replacing the --------------- by a special character like ||| and then change this character by a newline using awk FS=||| OFS=\n Can anyone help me! thanks

    Read the article

  • Select a particular column using awk or cut or perl

    - by javed abbas
    Have a requirement to select the 7th column. eg: cat filename | awk '{print $7}' The issue is that the data in the 4th column has multiple values with blank in between. example - The last line in the below output: user \Adminis FL_vol Design 0 - 1 - group 0 FL_vol Design 19324481 - 3014 - user \MAK FL_vol Design 16875161 - 2618 - tree 826 FL_vol Out Global Doc Mark 16875162 - 9618 - /vol/FL_vol/Out Global Doc Mark

    Read the article

  • AWK Shift empty column to left (to start position)

    - by Filip Zembol
    INPUT: fofo jojo tst fojo jofo sts rhr hrhh dodo jojo hoho jojo zozo roro vovo OUTPUT: fofo jojo tst fojo jofo sts rhr hrhh dodo jojo hoho jojo zozo roro popo NOTE: Please help me, I need to shift all rows, which have first column empty. Every fields are tab delimited. In this file some rows start from first column, but some rows start from second or third column. Thank you

    Read the article

  • bash split text into limited character buckets (array member)

    - by soField
    i have text such as http://pastebin.com/H8zTbG54 we can say this text is set of rules splitted by "OR" at the end of lines i need to put set of lines(rules) into buckets (bash array members) but i have character limit for each array member which is 1024 so each array member should contain set of rules but character count for each array member can not exceed 1024 can anybody help me to do that solaris 10

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >