Searching an Argument

Posted on 2006-06-02
Last Modified: 2010-04-21

I am using a more command on doing a search on a string argument.

Below is what I am doing

more "filename" |  grep "Argument"

But this is only giving me the specific argument only in the file.

What I want to do is I want to get the Argument and from there I want to move forward in the whole file

"that means I want to get argument and from there I should the start reading the file."

I hope I made by question clear.

Is there any command which allows me to do that..


Question by:ruby_srinivas
    LVL 23

    Accepted Solution

    use 'less' instead of 'more', since less provides searching capability:

      less -p "Argument" "filename"

    will start viewing the file "filename" from the first occurrence of "Argument".
    LVL 6

    Assisted Solution

    try this way

    line=`fgrep -n "argument"  filename | cut -f1 -d':'|head -1`
    tail +$line yourfile
    LVL 20

    Assisted Solution

    if you have awellbehaved more, it can actually do:
    more +/Argument filename
    which would acomplish the task... in mores old and quirky way:-). The line containing the pattern (Argument) would be the third from the top...

    -- Glenn
    LVL 6

    Expert Comment


    Fire up more and use /string to find a string; note use just / to find the same string again. This / is a command - not the +/ option on the more command line.

    $  more filename


    LVL 20

    Expert Comment

    JJ, this is exactly the same ... The "+...." syntax is just to "jumpstart" more with a command... Completely analogous with other paginators... And it fits with the initial Q;-)

    -- Glenn

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (…
    About FreeBSD Jails In FreeBSD, jails are a way of doing operating system level virtualization.  The basis of FreeBSD jails is chroot (, which changes the root directory of processes.  As a…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now