Guest User

Untitled

a guest
Feb 18th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!bin/sh
  2. pattern=$1
  3. # obtienes el numero de linea donde se encuentra el pattern
  4. line_number=$(grep -nE $pattern ApplicationLog.txt | grep -oE "^[0-9]+")
  5. # un ciclo for para leer las 6 lineas
  6. for i in `seq 0 6`;
  7. do
  8. line=$(($i + $line_number))
  9. #con awk obienes la linea n de un archivo y lo escribes en el archivo de salida
  10. awk "NR==$line" ApplicationLog.txt >> emailbody.txt
  11. done
Add Comment
Please, Sign In to add comment