Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 407
Simone Baldoni Avatar asked Nov 02 '25 02:11

Simone Baldoni


2 Answers

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

like image 166
Jim K Avatar answered Nov 04 '25 18:11

Jim K


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.

like image 34
pnuts Avatar answered Nov 04 '25 19:11

pnuts