I have a list of file names like

./run_results/rat/coding_exons/0.01_100_best.txt ./run_results/mouse/introns/0.01_100_best.txt

I want to create new files with names like rat_coding_exons_0.01_100_best.txt or mouse_introns_0.01_100_best.txt

Problem is, when I try to cut these file names, cut instead starts cutting each line in said files (sensible, but not what I want).


I'm not sure by what method you're passing those filenames to cut, but it seems that you're passing them as filenames rather than data to manipulate.

cut ... << 'EOF'

Instead of cut filename you want echo filename | cut (i.e. pass the filenames to cut as the input from stdin).

  • Works by itself, but when I pipe commands from find to echo it does not work. find . -name "*0.01*txt" | echo returns nothing so there is nothing for me to cut. That, however is not your fault so upvote. – The Unfun Cat Jun 23 '13 at 8:48
  • It was an example, the difference between giving cut the filename to process and giving cut a string which matches the filename to process. – EightBitTony Jun 23 '13 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.