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, I'm trying to iterate through subfolders and check which files contain "System.out.print" (using grep) using a second grep, trying to get the file names and line numbers using the sed command, I show them to the console. from here I want to remove "System.out.print" using "XXXXX", how can I pass the sed command to the command? Pls help me thanxx
GNU sed has the ability to modify files in place:
find Project1/ -type f | xargs sed -i 's/System\.out\.print/XXXXX/g'
Btw, your script can be written as:
grep -rsn 'root' /etc/ | awk -F: '{ print "filename is", $1, "and line number is", $2 }'
, , find -exec. _, , , .., ( ) - /dev,/sys,/proc . , xargs; .
find -exec
grep -HriIl --exclude-dir=dev --exclude-dir=proc --exclude-dir=sys search_text / | xargs sed -i 's/search_text/replace_text/g'
Source: https://habr.com/ru/post/1781804/More articles:map change during iteration on its input - javaFile name match in An example of using SharpArch with C # windows applications? - c #Mercurial command line client, read commands, parameters and arguments from a file? - command-lineOutlook - 0 × 8004010F Ошибка при доступе к установленному почтовому ящику - c#"Command line error for hg.exe too long" error in Mercurial - mercurialUmbraco Type Field Default Value - umbracohttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1781807/how-does-wcf-take-care-of-multiple-client-calls-to-the-server&usg=ALkJrhgPoAMi2dwunLbuWtGkS7XqJs6PqwPaid and free Android application - androidСамый простой способ создания пользовательского дистрибутива Linux - linuxAll Articles