Skip to main content

Linux - show few lines in a file


# Using head - Print few lines (5 lines) from the top of a file
head -n 5 file.txt

# Using tailPrint few lines (5 lines) from the bottom of a file
tail -n 5 file.txt


# Using sed

# show from line 12 to line 23
sed -n '12,23 p' archivo.txt

# or just one (line 15)
sed -n 15p archivo.txt

Comments

Popular posts from this blog

Start with flask

1. Install python 2. Python comes with pip. Else install pip 3. pip install Flask 4. Create a file flaskFirst.py from flask import Flask app = Flask(__name__) @app.route('/') def index():     return 'Index Page' 3. Go to the path where the flaskFirst.py is present 4. export FLASK_APP=flaskFirst.py 5. flask run