0

I am in the process of concatenating ogg audio files in bulk with the help of ffmpeg using a mylist.txt file

The format of the mylist.txt file is

file '/path/to/file1.wav'
file '/path/to/file2.wav'
file '/path/to/file3.wav'

My 'ls -l' output sample of WhattsAPP ogg audio files is similar to

-rw-rw-r-- 1 work work  64112 Nov 14 18:43 'WhatsApp Ptt 2019-11-11 at 10.19.18 AM.ogg'
-rw-rw-r-- 1 work work  24616 Nov 14 18:43 'WhatsApp Ptt 2019-11-11 at 10.19.50 AM.ogg'
-rw-rw-r-- 1 work work  26166 Nov 14 18:43 'WhatsApp Ptt 2019-11-11 at 10.20.18 AM.ogg'
-rw-rw-r-- 1 work work  69895 Nov 14 18:43 'WhatsApp Ptt 2019-11-11 at 10.21.05 AM.ogg'
-rw-rw-r-- 1 work work  85416 Nov 14 18:43 'WhatsApp Ptt 2019-11-11 at 10.27.09 AM.ogg'
  1. How do I get only the 'WhatsApp Ptt 2019-11-11 at 10.19.18 AM.ogg' portions of each line in the 'ls -l' output using cut, sed, awk or any other tool into a file using a single command?

  2. How do I add the keyword "file" before all file names in the file using a single command?

  3. Can process 1. & 2. be combined into a single command?

The contents of the final file need to look like:

file 'WhatsApp Ptt 2019-11-12 at 10.21.59 AM.ogg'
file 'WhatsApp Ptt 2019-11-12 at 10.29.45 AM.ogg'
file 'WhatsApp Ptt 2019-11-12 at 10.31.52 AM.ogg'
file 'WhatsApp Ptt 2019-11-12 at 9.31.38 AM.ogg'
Siju George
  • 155
  • 9

2 Answers2

3

/bin/ls -1

That leaves out all the goo :)

The problem being that ls in most distributions is aliased to something like “ls -la”. You can check that with “alias ls” and see if anything comes up

Also using an absolute path (with /bin/) will avoid using the alias.

Franz Bettag
  • 927
  • 8
  • 7
3

It's simpler to use a glob instead of ls to work with a list of file names

for f in *; do
  echo file \'$f\'
done
Bert
  • 2,863
  • 12
  • 13