Farid Ahmadian / Scripts

cut by examples

Example 1


    cut -f 2-

Output Format

    For each line in the input, print the fields from second fields to last field.

Example 2


    cut -f -3 -d " "

Output Format

    The output should contain N lines. For each input sentence, identify and display its first three words. Assume that the space (' ') is the only delimiter between words.

Example 3


    while read p; do
        cut -c 13- <<< $p
    done;

Output Format

    The output should contain N lines. For each input line, print the characters from thirteenth position to the end.

Example 4


    while read p; do
        cut -f 1-3 -d $'\x09' <<< $p
    done;

Output Format

    The output should contain N lines. For each line in the input, print the first three fields.

BY: Farid Ahmadian
TAG: cut
DATE: 2020-06-02 22:36:39


Farid Ahmadian / Scripts [ TXT ]

With many thanks and best wishes for dear Pejman Moghadam, someone who taught me alot in linux and life :)