Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional awk, head, and less/more examples #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ This is a cheat sheet for "Bourne-again shell" (bash) and GNU/Linux commands.
tail -n +2 filename.txt
```

### View first 5 lines of a file

```
head -5 filename.txt
```

### Omit first line of file from AWK processing

```
awk -F "\t" '{
if (FNR==1){
next
};
tot = tot + $5 + $4 # declare variables here
END {print tot;}' <file>
```

### View files without loading full file (like with vim)

```
less <filename>
```
or
```
more <filename>
```

## Compressing and decompressing files

### Create a gzipped tarball from a `*` glob command
Expand Down Expand Up @@ -92,3 +119,12 @@ To install a program from source on a shared cluster, you will often need to spe
./configure --prefix=/projects/ps-yeolab/software
make && make install # "make install" will run only if "make" is successful
```

## Using Git

### Git Cheatsheet

```
http://swcarpentry.github.io/git-novice/reference.html
```