Commit 4c276ca4 authored by Jyothis Jagan's avatar Jyothis Jagan
Browse files

Update session2.md

parent 1cd3656d
#Text Editing and Searching
##Console Text Editors
# Text Editing and Searching
## Console Text Editors
Below given are some of them.
* Vim
......@@ -9,17 +9,17 @@ Below given are some of them.
The session started with trying text editing with [micro](https://micro-editor.github.io/).
###Installing micro
### Installing micro
The package micro is available for sid as of now.
In Buster, we can download the package for sid from [here](https://packages.debian.org/sid/micro) and install it using dpkg cmmand or Discover application.
In Buster, we can download the package for sid from [here](https://packages.debian.org/sid/micro) and install it using `dpkg` command or Discover application.
For example
sudo dpkg -i micro_1.4.1-2_amd64.deb
###Basic Commands in micro
### Basic Commands in micro
Ctrl-Q Quit
Ctrl-S Save
......@@ -35,39 +35,38 @@ Ctrl-V Paste
For the complete list of default keys, Enter command mode using `Ctrl-E` and type `help defaultkeys`.
##Search
###grep
## Search
### grep
Refer [A Beginner’s Guide to Grep: Basics and Regular Expressions](https://opensourceforu.com/2012/06/beginners-guide-gnu-grep-basics/)
> Pirate Praveen:
> grep pattern * -R is what I commonly use
> Pirate Praveen: `grep pattern * -R` is what I commonly use.
>
> for example if I want to search for Apache license text in existing packages to copy paste to a new package
> grep Apache ../*/debian/copyright
>
> `grep Apache ../*/debian/copyright`
>
> the parent dirtectory usually have all the packages
* `git grep` enables you to search among all the tracked files in a git repository.
* You can pass the number of worker threads using `git grep --threads <number>`
###find
### find
Refer [A find Tutorial and Primer](https://danielmiessler.com/study/find/)
> Akhil : you can use it to filter out files matching a certain pattern.
>
>Eg:- find . -type f -newermt 2018-05-01 | grep "syslog\|kern\|daemon\|messages\|debug"
>Eg:- `find . -type f -newermt 2018-05-01 | grep "syslog\|kern\|daemon\|messages\|debug"`
>
> In this example I run this in /var/logs to find files which contain the names syslog, kern, daemon, mesages. debug. Like everything in Unix I combine it with find to filter out files newer than a particular date, 2018-05-01 in this case.
> In this example I run this in `/var/logs` to find files which contain the names syslog, kern, daemon, mesages. debug. Like everything in Unix I combine it with find to filter out files newer than a particular date, 2018-05-01 in this case.
>
> Always use -t with find. If you know that what you are searching for, it cuts down a large amount of time. -t f includes files alone in its search. -t d just includes directories.
> Always use -t with `find`. If you know that what you are searching for, it cuts down a large amount of time. `-t f` includes files alone in its search. `-t d` just includes directories.
##Find and Replace
###sed
## Find and Replace
### sed
Refer [Ultimate Sed Tutorial With Examples](https://www.poftut.com/ultimate-sed-tutorial-with-examples/)
> Pirate Praveen:
> I had to use sed with some js packages to modify the final built files like adding some lines at the end so that it becomes compatible
> grep sed */debian/rules -R
> I had to use `sed` with some js packages to modify the final built files like adding some lines at the end so that it becomes compatible
>
> `grep sed */debian/rules -R`
>
> see one example [here](https://salsa.debian.org/js-team/node-timeago.js/blob/master/debian/rules#L12)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment