Grep, Awk and Sed

Post date: Mar 02, 2019 3:31:29 PM

Basic "Options" for SED Command in UNIX

# connect_server.shssh ${user_name}@$server_name

# ping_server.shping -c3 $server_addr 2>&1 > /dev/null || echo "Server Dead"

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/g' my_file

#NB By default the output is written to stdout. You may redirect this to a new file, or if you want to edit the existing file in place you should use the '-i' flag:sed -e 's/input/output/' my_file > new_file sed -i -e 's/input/output/' my_file

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.shsed -e 's/input/output/' my_file 

# ping_server.sh

sed -e 's/input/output/g' my_file file

# The next lines creates the directory if it does not existtest -d $HOME/$dir_name || mkdir -m 700 $HOME/$dir_name# The find command will copy files the match the search criteria ie .sh . The -path, -prune and -o # options are to exclude the backdirectory from the # backup.find $HOME -path $HOME/$dir_name -prune -o \ -name "*$file_suffix" -exec cp {} $HOME/$dir_name/ \;

# Find the customer id as string in specified directory find /usr/local/tomcat9/logs/ -type f -exec grep -l "$custid" {} \;