Advertisement
Guest User

Untitled

a guest
Feb 18th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [[ $# -eq 0 ]] ; then
  4.     echo 'pass uid to script, ex 201507030906, or 201407271365'
  5.     exit 0
  6. fi
  7.  
  8. file=$1
  9.  
  10. printf "\n# Links to file:\n\n"
  11. ag $file
  12.  
  13. printf "\n# Before and After:\n\n"
  14.  
  15. ls|ag -C3 $file
  16.  
  17. printf "\n\n# Mutual Links\n\n"
  18. link=$(ag -o "(?<=§|\[)[0-9]{12}" $file*|sort -n |uniq)
  19.  
  20. for line in $link
  21.   do
  22.     title=$(ag -g $line)
  23.     printf "\n## $title \n\n"
  24.     ag $line| ag -v $file
  25.   done
  26.  
  27. printf "\n\n# Mutual References\n\n"
  28. ref=$(ag -o "(?<=\@)[a-z]*[0-9]*[a-z]*" $file*|sort -n |uniq)
  29.  
  30. for line in $ref
  31.   do
  32.     title=$line
  33.     printf "\n## $title \n\n"
  34.     ag -o $line| ag -v $file
  35.   done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement