Quantcast
Channel: Preguntas más recientes con las etiquetas linux - Stack Overflow en español
Viewing all articles
Browse latest Browse all 1694

Cortar una linea de texto de un archivo a otro en Bash o linux

$
0
0

Estoy buscando la manera de que el siguiente código corte la linea del archivo1.txt que lee el bucle con funcion read despues de haberlo pegado con el formato adecuado en el archivo2.txt. Alguna sugerencia?Gracias de adelanto

#!/bin/shwhile true;dowhile read linea;dovarnombre=$(echo "$linea" | cut -d " " -f 3 | cut -d "/" -f 1)data=$(echo "$linea" | cut -d ":" -f 12 | cut -d "," -f 1 | sed -e "s/^.//" -e "s/.$//")hora=$(echo "$linea" | cut -d "T" -f 1 | cut -d "." -f 1)fecha=$(echo "$linea" | cut -d "T" -f 4 | cut -d ":" -f 2 | sed -e "s/^.//")echo "$data $hora $fecha $varnombre" >> archivo2.txtdone < /home/usuario/archivo1.txtdone

Viewing all articles
Browse latest Browse all 1694


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>