grep pipe with sed

Posted by 123Ex on Stack Overflow See other posts from Stack Overflow or by 123Ex
Published on 2010-12-23T10:01:35Z Indexed on 2010/12/23 12:54 UTC
Read the original article Hit count: 183

Filed under:
|
|

hi,

This is my bash command

grep -rl "System.out.print" Project1/ | 
    xargs -I{} grep -H -n "System.out.print" {} |
    cut -f-2 -d: |
    sed "s/\(.*\):\(.*\)/filename is \1 and line number is \2/

What I'm trying to do here is,I'm trying to iterate through sub folders and check what files contains "System.out.print" (using grep) using 2nd grep trying to get file names and line numbers using sed command I display those to console. from here I want to remove "System.out.print" with "XXXXX" how I can pipe sed command to this? pls help me thanxx

© Stack Overflow or respective owner

Related posts about bash

Related posts about sed