I have a text file with some information. How can I write only odd numbered lines from that file to a new file? Using shell script..
You could use
sed '2~2d' file > new-file
This starts from the second line, matches every 2nd line after that, and deletes the matched lines from the stream. The remaining odd-numbered lines are redirected to a new file.
awk 'NR%2' file > newFile
NR is the number of the current line;
NR%2 = odd line