Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.44 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. abc.out
  2. def.out
  3.        
  4. # input_file:
  5.  
  6. abc.out abc.out abc.out
  7. def.out def.out
  8. def.out
  9.        
  10. sed -i 's/.out//g' input_file
  11.        
  12. var1="abc.out"
  13.        
  14. var1=${var1%.out}
  15. echo "$var1"
  16.  
  17. abc
  18.        
  19. $ foo=abc.def.out
  20. $ echo ${foo%.out}
  21. abc.def
  22.        
  23. $ echo ${foo%.*}
  24. abc.def
  25.        
  26. $ echo ${foo%%.*}
  27. abc
  28.        
  29. $ basename a.out .out
  30.        
  31. a
  32.        
  33. echo ${str%.*}
  34.        
  35. echo $str | grep -o '^[^.]*'
  36.        
  37. echo $str | sed -E 's/(.*?)..*/1/'
  38.        
  39. echo $str | awk -F. '{print $1}'
  40.        
  41. abc