Deleting Line Containing Specific String

Deleting Lines Containing Specific string from multiple files

Deleting Lines Containing Specific string from multiple files Deleting Lines Containing Specific string from multiple files recursively Syntax: Example: Below example delete lines containing @license tag from src/main/php directory all files recursively Option Description: -R or –dereference-recursive For each directory operand, read and process all files in that directory, recursively, following all symbolic links. -l…

Read More

Rename all Files in the Directory

Here is the simple shell script to rename all files in the folder with increasing number. In below example I am going to rename all jpg image with increasing number. #!/bin/bash a=1 for i in *.jpg; do new=$(printf “%04d.jpg” “$a”) mv — “$i” “$new” let a=a+1 done Output: 0001.jpg 0002.jpg 0003.jpg 0004.jpg 0005.jpg 0006.jpg 0007.jpg…

Read More

Run Mysql Query from Command Line

Shell script to run mysql query from command line without login into mysql command prompt.  You can use these shell script for quickly execution of MySQL query from a Linux Shell. Method 1: #!/bin/bash #Script to run mysql query from command line #Db Connection. DB_USER=’root’ DB_PASSWD=’mypwd’ DB_NAME=’mydb’ #Prepare sql query QUERY=’select * from employee’ #Command to connect…

Read More
Verified by MonsterInsights