Created
May 22, 2024 14:37
-
-
Save horaciod/d2720fe300336204f5a885dbf641c712 to your computer and use it in GitHub Desktop.
Extrae las lineas entre dos palabras ingresadas entrepalabras.sh archivo.txt p1 p2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
archi=$1 | |
t1=$2 | |
t2=$3 | |
linea=`grep -n "\[$2\]" $archi ` | |
#separador | |
IFS=':' | |
# Read the split words into an array | |
# based on space delimiter | |
read -ra newarr <<< "$linea" | |
nlinea="${newarr[0]}" | |
linea2=`grep -n "\[$3\]" $archi ` | |
read -ra newarr <<< "$linea2" | |
nlinea2="${newarr[0]}" | |
#tail --lines=+$nlinea $1 |head -$nlinea2 | |
cat $1 |sed -n "${nlinea},$((nlinea2-1))p" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ejemplo
entre.sh config.php OAI Proxy