How do you run `less` and have it run a search pattern automatically?

Neil

I'm trying to run less in Linux, and I want it to search for something immediately after launch.

It's basically like doing this:

$ less

Then press '/', type a search pattern like "^commit \w+$", then press enter, and press 'n' to find each subsequent result.

I'd like less to be launched, and then search for a pattern. There doesn't seem to be anything in the man page about starting with a pattern, but perhaps you can send it commands like Vim.

goldPseudo

From the man page:

   -ppattern or --pattern=pattern
          The  -p  option  on the command line is equivalent to specifying
          +/pattern; that is, it tells less to start at the  first  occur-
          rence of pattern in the file.

This works as expected using the latest version of less (436).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Do you have to run Composer on localhost and on production?

From Dev

How to have Rails migrations run automatically on Heroku

From Dev

How can I make 'grunt less' automatically run autoprefixer?

From Dev

How do you run a shell command/script automatically when entering/cd-ing a directory on Snow Leopard?

From Dev

How do you automatically run a .bat file from a flashdrive with cmd programming?

From Dev

How do you see what rails3 migrations have been run against a database

From Dev

How do you see what rails3 migrations have been run against a database

From Dev

How do you run Karma after installation?

From Dev

How do you run Jasmine tests in the browser?

From Dev

How do you run Java codes in emacs?

From Dev

How do you run the SecureSocial demo?

From Dev

How do you run bash script as a command?

From Dev

How do you run a python script in OpenElec

From Dev

How do you run a cloud function at an interval?

From Dev

How do you run a cloud function at an interval?

From Dev

How do you run DalekJS on iOS?

From Dev

How do you run an Android Wearable app?

From Dev

How do you use concordion:run with parameters?

From Dev

How do you run a command with sudo in `~/.profile`?

From Dev

How can you get grunt to run automatically each day?

From Java

Do you have to put Task.Run in a method to make it async?

From Dev

"you do not have the hardware required to run Unity" on VMware

From Dev

How to have two JARs start automatically on "docker run container"

From Dev

How to run crawler automatically?

From Dev

How to run this code automatically

From Dev

how to run redshift automatically

From Dev

How can you run an ldap search using variables and a not filter?

From Dev

Run a file automatically in terminal when you click on it

From Dev

C - Forks & Pipes, How do you open a process for every file to run a word count and have the parent process sum the results?

Related Related

  1. 1

    Do you have to run Composer on localhost and on production?

  2. 2

    How to have Rails migrations run automatically on Heroku

  3. 3

    How can I make 'grunt less' automatically run autoprefixer?

  4. 4

    How do you run a shell command/script automatically when entering/cd-ing a directory on Snow Leopard?

  5. 5

    How do you automatically run a .bat file from a flashdrive with cmd programming?

  6. 6

    How do you see what rails3 migrations have been run against a database

  7. 7

    How do you see what rails3 migrations have been run against a database

  8. 8

    How do you run Karma after installation?

  9. 9

    How do you run Jasmine tests in the browser?

  10. 10

    How do you run Java codes in emacs?

  11. 11

    How do you run the SecureSocial demo?

  12. 12

    How do you run bash script as a command?

  13. 13

    How do you run a python script in OpenElec

  14. 14

    How do you run a cloud function at an interval?

  15. 15

    How do you run a cloud function at an interval?

  16. 16

    How do you run DalekJS on iOS?

  17. 17

    How do you run an Android Wearable app?

  18. 18

    How do you use concordion:run with parameters?

  19. 19

    How do you run a command with sudo in `~/.profile`?

  20. 20

    How can you get grunt to run automatically each day?

  21. 21

    Do you have to put Task.Run in a method to make it async?

  22. 22

    "you do not have the hardware required to run Unity" on VMware

  23. 23

    How to have two JARs start automatically on "docker run container"

  24. 24

    How to run crawler automatically?

  25. 25

    How to run this code automatically

  26. 26

    how to run redshift automatically

  27. 27

    How can you run an ldap search using variables and a not filter?

  28. 28

    Run a file automatically in terminal when you click on it

  29. 29

    C - Forks & Pipes, How do you open a process for every file to run a word count and have the parent process sum the results?

HotTag

Archive