I posted this before and I got a bunch of BS answers people

I posted this before and I got a bunch of BS answers - people dont pay for BS answers - please give me something that works in UNIX...

Devise a sequence to display a count of lines containing strings containing
in all .html files in the current directory.
is case-insensitive. It can be upper or lower case.

Solution

In UNIX you can use the grep command.

Here all lines in .hrml file starts with <.

grep -i \"<[a-z][A-Z]>\" * | wc

the output of above command will be three numbers the first number is the number of lines as per given criteria and second no. of words and third is no.of characters.

Notes :

grep is used to search text for patterns specified by the user. It is one of the most useful and powerful commands on Linux and other Unix-like operating systems.

grep\'s basic syntax is

grep [option(s)] pattern [file(s)]

The items in square brackets are optional. When used with no options and no arguments (i.e., input files), grep searches standard input (which by default is text typed in at the keyboard) for the specified pattern and returns each line that contains a match to standard output (which by default is the display screen).

A line of text is defined in this context not as what appears as a line of text on the display screen but rather as all text between two newline characters. Newline characters are invisible characters that are represented in Unix-like operating systems by a backslash followed by the letter n and which are created when a user presses the ENTER key when using a text editor (such as gedit). Thus, a line of text returned by grep can be as short as a single character or occupy many lines on the display screen.

grep can search any number of files simultaneously. Thus, for example, the following would search the three files file1, file2 and file3 for any line that contains the string (i.e., sequence of characters) Lin:

grep Lin file1 file2 file3

wc :

wc prints newline, word, and byte counts for each FILE, and a total if more than one FILE is specified. With no FILE, or when FILE is a dash (\"-\"), wc operates on standard input. (A word is a non-zero-length sequence of characters delimited by white space.)

The options below may be used to select which counts are printed. Counts are always in the following order: newline, word, character, byte, maximum line length.

wc syntax

I posted this before and I got a bunch of BS answers - people dont pay for BS answers - please give me something that works in UNIX... Devise a sequence to disp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site