Hello.
I have a question as to why my grep command does not seem to be working.
Code:
grep -c '^[K]?*' ~
Code:
grep -c '^[K].*' ~
I wanted to count the number of files starting with the letter K and have some letters after that. I have such files in my home directory. However, the output is 0. So, I have no ideas why it makes the wrong output. Thanks in advance!!! :o
I am able to locate files in a folder containing a specific text string using this command:
grep -lir 'string' ~/directory/*
How do I move the files that appear in the above result to another location?
I have a list of file names as output of certain command.
I need to find each of these files in a given directory.
I tried following command:
ls -R /home/ABC/testDir/ | grep "\.java" | xargs find /home/ABC/someAnotherDir -iname
But it is giving me following error:
find: paths must precede expression: XYZ.java
What would be the right way to do it?
I want to get a Linux command's output string as well as command output status in a C++ program.
Possible Duplicate:
I specifically want to delete my grep output string from the text file
I'm a little bit new with Linux and I have a problem.
I have a text file called file_a.txt My first
command
grep -A 12 ".production =" file_a.txt
The output is a few block.
I want to execute the for loop with sed command, and is getting an error for the same
for i in <comma-separated server name list>;do "command";echo $i;done
where command=sed '/^$/d' /home/nextag/instance.properties|grep -vc '#'
I'm getting the following error :- -bash: sed "/^$/d" /home/nextag/instance.properties|grep -vc#: No such file or directory
lu1
What is the correct way to execut
Here Is a problem I am facing with awk.
Query --> I want to search for a string in a file and print next 15 lines below the matched string.
1.We do not have GNU grep so cannot use grep -A or grep -B commands.
2. Instead of passing the search pattern as a string to awk.
I seriously can't understand where I'm going wrong with his question. The first part is.
List all the file and directory names in /etc which have 1 or more numbers in their name. Remember to use "-d" in the ls command, and do not descend into subdirectories (i.e. no recursion). Save this list in caine's home directory as a file called "digit".
I am trying to use the tee command to redirect output to a file, and I want the file to be created in a dir which is yet to be created.
date | tee new_dir/new_file
when new_dir is not there, the tee command fails saying
tee: new_dir/new_file: No such file or directory
If I create the new_dir prior to running the tee command, then it works fine, but for some reason I don't want to create t