Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
grp-bio-it
linuxcommandline
Commits
5fe0dedf
Commit
5fe0dedf
authored
Jan 27, 2017
by
Nicolai Karcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearranged and realigned new awk entry properly
parent
50ddff8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
linux_intermediate/commandlinetools.rst
linux_intermediate/commandlinetools.rst
+20
-19
No files found.
linux_intermediate/commandlinetools.rst
View file @
5fe0dedf
...
...
@@ -530,25 +530,6 @@ where the second column is 'PDBsum':
1A1A;
...
Moreover, ``awk`` allows us to write a very simple one-liner for printing only the x-th, (2*x)-th, (3*x)-th ... line of a file.
To give an example, the following line prints every third line of the file 'manylines.txt'.
::
# cat manylines.txt
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
# awk 'NR % 3 == 0' manylines.txt
line3
line6
line9
Note the double equal signs "==" to check for equality and note the quotes around
"PDBsum;".
If you want to match a field, but not exactly, you can use '~' instead of '==':
...
...
@@ -568,6 +549,26 @@ If you want to match a field, but not exactly, you can use '~' instead of '==':
..
.. awk '{sum+=$1} END {print sum}' file.txt
Moreover, ``awk`` allows us to write a very simple one-liner for printing only the x-th, (2*x)-th, (3*x)-th ... line of a file.
To give an example, the following line prints every third line of the file 'manylines.txt'.
::
# cat manylines.txt
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
# awk 'NR % 3 == 0' manylines.txt
line3
line6
line9
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment