Sed: Extract a file's part with sed command
#!/bin/bash
# February 3rd, 2018
export Me=$(basename $0 .sh)
export fecha_actual=`date "+%Y-%m-%d_%H%M%S"`
inputFile=notas.txt
pattern="find" # cut the file here
echo "$inputFile"
# q: show the file until the pattern, including it.
# Q: show the file until the pattern, NOT including it.
sed "/$pattern/Q" $inputFile
# February 3rd, 2018
export Me=$(basename $0 .sh)
export fecha_actual=`date "+%Y-%m-%d_%H%M%S"`
inputFile=notas.txt
pattern="find" # cut the file here
echo "$inputFile"
# q: show the file until the pattern, including it.
# Q: show the file until the pattern, NOT including it.
sed "/$pattern/Q" $inputFile
Comentarios