Attachment 'cheatsheet.txt'

Download

   1 ####################################################
   2 # UNIX - THE BASIC COMMANDS
   3 # -- created by judith degen on 10/17/2009
   4 ####################################################
   5 
   6 ************************************************
   7 * PART I: navigating the directory structure
   8 ************************************************
   9 
  10 # Log onto slate:
  11 # ssh USERNAME@slate.hlp.rochester.edu
  12 ssh jdegen@slate.hlp.rochester.edu
  13 
  14 # Change your password!
  15 passwd
  16 
  17 # Show the contents of your current directory. If you just logged on, this will be your home directory.
  18 ls
  19 
  20 # For more information about file size/type/permissions
  21 ls -l
  22 
  23 # Show the contents of the directory /corpora/TDTlite.
  24 ls /p/hlp/tools/TDTlite
  25 
  26 
  27 # Move to the directory /corpora/TDTlite
  28 cd /corpora/TDTlite
  29 
  30 # Show the contents of the directory /corpora/TDTlite/sample_project
  31 ls /p/hlp/tools/TDTlite/sample_project
  32 
  33 # Move back to your home directory.
  34 cd
  35 
  36 # Move one directory up.
  37 cd ..
  38 
  39 # Check where you are.
  40 pwd
  41 
  42 # Figure out how to use a command.
  43 # man COMMANDNAME
  44 man cp
  45 
  46 # Copy the sample_project directory to your home directory with cp and rename it with mv.
  47 cp -r /p/hlp/tools/TDTlite/sample_project .
  48 mv sample_project myproject
  49 
  50 # Create a directory.
  51 mkdir mydir
  52 
  53 # Remove the directory you just created from your home directory. BE VERY CAREFUL WITH THE rm COMMAND!
  54 rm -r mydir
  55 
  56 # To copy file myfile.txt from your home directory on the server to your current directory on your computer:
  57 scp jdegen@slate.hlp.rochester.edu:./myfile.txt .
  58 
  59 # To copy the directory myproject from your home directory on the server to your current directory on your computer:
  60 scp -r jdegen@slate.hlp.rochester.edu:./myproject .
  61 
  62 ************************************************
  63 * PART II: the basics of tgrep2
  64 ************************************************
  65 
  66 # Run tgrep2
  67 tgrep2 "ADJP"
  68 
  69 # Run tgrep2 on the Wall Street Journal. Search for all VPs
  70 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz "ADJP"
  71 
  72 # The same, but print only terminals
  73 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -t "ADJP"
  74 
  75 # Print the entire sentence
  76 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -tw "ADJP"
  77 
  78 # Save the output to a file
  79 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -tw "ADJP" > adjp.txt
  80 
  81 # View the contents of adjp.txt
  82 less adjp.txt
  83 
  84 # Search inside adjp.txt for "awesome":
  85 /awesome
  86 
  87 # Count the lines in adjp.txt
  88 wc -l adjp.txt
  89 
  90 # Output the match ID in front of the match itself. \t is a special character that inserts a tab, similarly \n inserts a newline
  91 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -m '%xm\t%tm\n' "ADJP"
  92 
  93 # Always use the -af options, they make sure all your matches are found if for example there are multiple matches within one sentence
  94 
  95 # Two ADJP that are sisters, print first one, tab, second one
  96 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz -m '%t=a1= \t %t=a2=\n' "ADJP=a1 $ ADJP=a2"
  97 
  98 # Create a MACRO file
  99 vi
 100 
 101 # In the vi, there are a number of commands you can use:
 102 # :w FILENAME - save file as FILENAME
 103 # :q - quit
 104 # :wq - save and quit
 105 # 0 - move to start of line
 106 # $ - move to end of line
 107 # 1G - move to first line
 108 # G - move to last line
 109 # i - insert text before cursor, until <Esc> is hit
 110 # a - insert text after cursor, until <Esc> is hit
 111 # r - replace single character under cursor
 112 # R - replace characters until <Esc> is hit
 113 # x - delete character under cursor
 114 # dd - delete entire current line
 115 # yy - copy the current line
 116 # p - paste the line(s) in the buffer into the text after the current line
 117 
 118 # Create a macro @AA that contains the ADJP pattern from above:
 119 i
 120 @ AA	ADJP=a1 $ ADJP=a2;
 121 <Esc>
 122 :w MACRO.ptn
 123 :q
 124 
 125 ************************************************
 126 * PART III: regular expressions
 127 ************************************************
 128 
 129 # Regular expressions in tgrep2 belong between //
 130 # Probably the most useful one will be /^NODENAME_START/ - which finds all nodes that begin with NODENAME_START
 131 tgrep2 -c /corpora/TGrep2able/wsj_mrg.t2c.gz "/^ADJP/"
 132 
 133 # Special characters:
 134 # ^ - start of string
 135 # $ - end of string
 136 # . - any character
 137 # * - any node
 138 # | - any of the strings separated by |
 139 
 140 # /^AD/ matches "ADJP", "ADJP-PRD", "ADVP", "ADVP-LOC", "ADVP-MNR"...
 141 # /VP$/ matches "ADVP", "VP"
 142 # /AD.P/ matches "ADVP", "ADJP", "WHADVP"
 143 # /ADVP|ADJP/ matches "ADVP", "ADJP"

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2016-03-16 12:56:32, 4.2 KB) [[attachment:cheatsheet.txt]]
  • [get | view] (2016-03-16 12:56:32, 937.1 KB) [[attachment:tgrep2_slides.pdf]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.

MoinMoin Appliance - Powered by TurnKey Linux