Insert multiple lines into a file after specified pattern using shell script

Another sed, sed ‘/cdef/r add.txt’ input.txt input.txt: abcd accd cdef line web add.txt: line1 line2 line3 line4 Test: sat:~# sed ‘/cdef/r add.txt’ input.txt abcd accd cdef line1 line2 line3 line4 line web If you want to apply the changes in input.txt file. Then, use -i with sed. sed -i ‘/cdef/r add.txt’ input.txt If you want … Read more

find difference between two text files with one item per line [duplicate]

grep -Fxvf file1 file2 What the flags mean: -F, –fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -x, –line-regexp Select only those matches that exactly match the whole line. -v, –invert-match Invert the sense of matching, to select non-matching lines. -f FILE, –file=FILE Obtain … Read more

Select row and element in awk

To print the second line: awk ‘FNR == 2 {print}’ To print the second field: awk ‘{print $2}’ To print the third field of the fifth line: awk ‘FNR == 5 {print $3}’ Here’s an example with a header line and (redundant) field descriptions: awk ‘BEGIN {print “Name\t\tAge”} FNR == 5 {print “Name: “$3″\tAge: “$2}’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)