NOTE: need to write file to user's home directory
place in user's bin directory, chmod 755 or execute as: sh ./catgrep filename
#!/bin/bash
################################################################################
# jm - 24 jun 2016 - cat, grep out blank lines and comments, option to save
################################################################################
USAGE="catgrep filename # removed commented and blank lines, option to save"
echo "$1"
cat $1 | grep -E -v '(^#|^$)'
echo "save info? Y,y"
read answer
if [ $answer = "y" ]
then
echo "$1" | tee $1-content-`date +%Y%b%d-%H%M`.txt
cat $1 | grep -E -v '(^#|^$)' | tee -a $1-content-`date +%Y%b%d-%H%M`.txt
else
echo 'thanx for using catgrep! next'
fi
########################################
|
![]() Wagoneers FULL SIZE JEEPS JeepMeister "Jeep is America's -Enzo Ferrari MeisterTech Diesels + |
One Page Overview![]() Intro to Linux |
|
at Midway Auto on SR9 in Snohomish, or at Northland Diesel in Bellingham, WA |