Home Copy lines containing a specific text from one file to another file
 This question already has an answer here: Grep for literal strings 5 answers I want to copy over all lines in a file (file1.txt) containing Cmd:[41] over to another file (file2.txt) awk '/Cmd:[41]/' file1.txt > file2.txt  This command doesn't seem to work. The file2.txt is of size 0. However there are lines in file1.txt that contains Cmd:[41] Is there some specific awk escape character that I should be using. The problem is with [41] part. The other part of the search string seems to work fine.