V
V
vvrider2014-12-15 00:35:35
linux
vvrider, 2014-12-15 00:35:35

How to print lines 15 to 35 in terminal them under terminal in linux?

I just started to study UNix from under linux
Interested in how to do: -
output lines from 15 to 35 and write to the file 15-35_app_log.txt
- add line 36 to the file 15-35_app_log.txt, rename the file acc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Starkov, 2014-12-15
@vvrider

It can be simpler, with one command, and the deltas in the head for tail do not need to be counted
cat sourcefile.txt | sed -n 15,35p

L
l_Nort-l, 2018-05-10
@l_Nort-l

If anything, here's my code:
#!/bin/bash
for i in $(find /etc/ -type f);
do cat $i | head-n5 | tail -n1 >> ~/000
done
sort ~/000
It takes all the files from the etc folder, takes the fifth line from them and outputs them to a file that it creates in the home directory and then sorts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question