The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
retrieved multiple lines on multiple places in a file
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
retrieved multiple lines on multiple places in a file
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
02-13-2008
otheus
Moderator ala Mode
Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,889
How do you know which lines you want and which you don't?
Let's say you want 3 lines, skip 3 lines, etc. Here's just one way (using
GNU
awk):
Code:
awk '(int((FNR-1)/ 3))%2 == 0' filename
otheus
View Public Profile
Visit otheus's homepage!
Find all posts by otheus
Find otheus's past nominations received
Find otheus's present nominations given