Guest User

Untitled

a guest
Apr 25th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. $ (head -n 1; tail -n 1) < файл
  2.  
  3. $ (head -n 1; wc -l) < файл
  4.  
  5. $ (wc -l; head -n 1) < файл
  6.  
  7. $ (busybox head -n 1; tail -n 1) < файл
  8.  
  9. $ cat файл | (head -n 1; tail -n 1)
  10. $ (head -n 1; tail -n 1) < <(cat файл)
  11.  
  12. $ head --version
  13. head (GNU coreutils) 8.26
  14. Copyright (C) 2016 Free Software Foundation, Inc.
  15. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
  16. This is free software: you are free to change and redistribute it.
  17. There is NO WARRANTY, to the extent permitted by law.
  18.  
  19. Written by David MacKenzie and Jim Meyering.
  20. $ wc --version
  21. wc (GNU coreutils) 8.26
  22. Copyright (C) 2016 Free Software Foundation, Inc.
  23. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
  24. This is free software: you are free to change and redistribute it.
  25. There is NO WARRANTY, to the extent permitted by law.
  26.  
  27. Written by Paul Rubin and David MacKenzie.
  28. $ bash --version
  29. GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
  30. Copyright (C) 2016 Free Software Foundation, Inc.
  31. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  32.  
  33. This is free software; you are free to change and redistribute it.
  34. There is NO WARRANTY, to the extent permitted by law.
  35.  
  36. $ cat file
  37. first line
  38. second line
  39. last line
  40.  
  41. $ (strace head -n 1; head -n 1) < file
  42. read(0, "first linensecond linenlast line"..., 8192) = 33
  43. lseek(0, -22, SEEK_CUR) = 11
  44. write(1, "first linen", 11) = 11
  45.  
  46. $ (truss head -n 1; head -n 1) < file
  47. read(0, " f i r s t l i n en s".., 4096) = 33
  48. write(1, " f i r s t l i n en", 11) = 11
  49. llseek(0, 0xFFFFFFFFFFFFFFEA, SEEK_CUR) = 11
  50.  
  51. $ (truss head -n 1 ; head -n 1) < file
  52. read(0,"first linensecond linenlast li"...,32768) = 33 (0x21)
  53. write(1,"first linen",11) = 11 (0xb)
  54.  
  55. $ cat файл | (head -n 1; head -n 1)
  56.  
  57. tee >(head -n1) >(tail -n1) >/dev/null
  58.  
  59. $ cat /tmp/file
  60. head_line
  61. body
  62. tail_line
  63.  
  64. head_line
  65.  
  66. head_line
  67. tail_line
  68.  
  69. head_line
  70. body
  71.  
  72. head_line
Add Comment
Please, Sign In to add comment