Simone Baldoni
Simone Baldoni

Reputation: 127

delete alternate lines in a csv file libreoffice calc

I have a csv file and I need to delete all even lines (example: line 2, line 4, line 6, etc.). There are over 7000. Is it possible to do this with a single command or function in LibreOffice Calc?

Upvotes: 4

Views: 3526

Answers (2)

pnuts
pnuts

Reputation: 59485

Excellent A (as usual) from @JimK but might not adapt too well if the rows to be deleted contain data in many columns. So though not a single command or function (more a process that should at least achieve the result, if not in the preferred way):

Fill as much of a (spare) column as required with:

=ISODD(ROW())

then filter to select FALSEs and delete these rows. The helper column may then also be deleted.

Upvotes: 1

Jim K
Jim K

Reputation: 13819

For example, if the data is in column A, then enter this formula in B1 and fill down.

=INDIRECT(ADDRESS(ROW()*2-1;1))

odd rows only

Upvotes: 4

Related Questions