Showing posts with label files. Show all posts
Showing posts with label files. Show all posts

Tuesday, January 24, 2012

Change file encoding in linux

1. Get encoding:

file -bi test.txt
text/plain; charset=us-ascii

2. Change it:

iconv -f ascii -t utf8 [filename] > [newfilename]

Sunday, January 15, 2012

awk , add column to file

Add column with line number to file:

awk '{print NR"\t"$0}' degrees_dir > degrees_dir_order

After:

head degrees_dir_order
1 669
2 667
3 600
4 596
5 580
6 549
7 490
8 460
9 454
10 447