1

Okay, so I have a big ol' beat finder label output from Audacity that looks like this:

25.651000            25.651000
25.666000            25.666000
25.685000            25.685000
25.718000            25.718000
25.737000            25.737000
26.244000            26.244000
27.050425            27.052000
27.853000            27.853000
27.867000            27.867000
28.674000            28.674000

However, as you can see Audacity decided to duplicate the first column twice. However, I don't want that second column. Is there anyway to delete that second column leaving me with something like this?

25.651000
25.666000
25.685000
25.718000
25.737000
26.244000
27.050425
27.853000
27.867000
28.674000

There are about 186 lines.

midori
  • 4,807
  • 5
  • 34
  • 62
ArchBlox
  • 21
  • 3

5 Answers5

4

This should do it for you;

cut -f 1 -d ' ' MyFile.txt

Results in:

25.651000
25.666000
25.685000
25.718000
25.737000
26.244000
27.050425
27.853000
27.867000
28.674000
AlG
  • 14,697
  • 4
  • 41
  • 54
  • 1
    You should not use `cat` with programs that can read data itself. It slows things down, uses more resources, loss of functionality. So `cut -f 1 -d ' ' MyFile.txt`. You code does not produce output you have from above data, just blank lines, since OP has space before his data in example above. – Jotne Jan 15 '15 at 19:25
  • @Jotne updated per your comments. Even though OP said he was good. :) – AlG Jan 15 '15 at 19:29
3

This should do:

awk '$0=$1' MyFile.txt
25.651000
25.666000
25.685000
25.718000
25.737000
26.244000
27.050425
27.853000
27.867000
28.674000

This is more secure, se Eds comment.

awk '{print $1}' MyFile.txt
Jotne
  • 40,548
  • 12
  • 51
  • 55
2

With GNU grep:

grep -oP ' \K[^ ]+' file

Output:

25.651000
25.666000
25.685000
25.718000
25.737000
26.244000
27.052000
27.853000
27.867000
28.674000
Cyrus
  • 84,225
  • 14
  • 89
  • 153
2
sed 's/ .*//' YourFile

remove anything since first space until the end

NeronLeVelu
  • 9,908
  • 1
  • 23
  • 43
1

There is sed for you:

sed 's/\(^.*\) .*$/\1/' file
midori
  • 4,807
  • 5
  • 34
  • 62