i'm looking to create a new CSV file from the first file, but the last line in the first file is the first line in the second file and so forth, until all the lines/rows are reversed.
cheers Jon
i'm looking to create a new CSV file from the first file, but the last line in the first file is the first line in the second file and so forth, until all the lines/rows are reversed.
cheers Jon
Using python only:
with open('data.csv', 'r', encoding='utf-8') as f:
lines = f.readlines()
with open('reversed_data.csv', 'w+', encoding='utf-8') as f:
for l in reversed(lines):
f.write(l)
Or via shell:
tail -r data.csv > reverse_data.csv