06-05-2017
Grep commands: need some practice help please
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Use the less command to view the words file.
To see the results of a grep that returns many rows, pipe the output of the grep into less. For example, grep ‘the' words | less
You can pipe the output of a grep command into wc -l to count lines instead of displaying them.
How many words in this file begin with the letter x?
How many words in this file begin with the letter z?
How many words in this file begin with the letter x or z?
find or count the words in dictionary that:
end in ing (such as counting)
include ing but not at the end (such as ringing)
begin with a capital letter
contain only two letters, the first is lower case, the second uppercase (such as kW)
contain only the letters in simon in any order (such as osmosis)
begin with a vowel (aeiou)
do not contain a vowel (such as rhythm)
contain four consecutive vowels (such as queue)
are there any words with 5 consecutive vowels?
can be spelled using the 7 hex letters (such as faced)
contain all five vowels in the correct order a,e,i,o,u
2. Relevant commands, code, scripts, algorithms:
grep, less,pipes,egrep
3. The attempts at a solution (include all code and scripts):
not sure how to do any of these
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
UCOL Palmerston North, New zealand, Simon Burt, T111
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Never mind, I did more research, and now am using grep -v './temp/', dumping it into a new text file, then using mv -f to make that the original file. Thanks for reading!
---------------
Hi folks, I haven't done any scripting in years, and now I have a problem. Our backup tapes are filling... (0 Replies)
Discussion started by: citygov
0 Replies
2. UNIX for Dummies Questions & Answers
I'm having trouble with the following commands
i. count the number of lines which end in a 4 letter word
grep '{4\}$' bfile <<seems to print out everything
abc abc abcd
joe joe john
bob bill
gregory greg
greg gregory
the grep command prints out the lines with 4 letter words and the... (3 Replies)
Discussion started by: StrengthThaDon
3 Replies
3. Shell Programming and Scripting
Hi All,
Reference to my previous post
I need to compare all the lines in the file1 with file2
for this condition if file1 {$3,$5} ==file2 {$3,$5} then grep file2{$1}latest date.
need output in file3
10/04/2008
09/04/2008
09/04/2008
08/04/2008
can anyone suggest me
Thanks... (0 Replies)
Discussion started by: karthikn7974
0 Replies
4. UNIX for Dummies Questions & Answers
How to run UNIX commands for practice in Windows 2000 OS?
If you suggest to install Cygwin, please let me know the procedure to install, or else I feel happy if you suggest any stand alone app for running UNIX commands..:) (2 Replies)
Discussion started by: Srikanthk
2 Replies
5. UNIX for Dummies Questions & Answers
I need your's help to display user with greep command form /etc/passwd
1. to display all login to begin and finishing with letter a or b
etc.users
admina
bserb
broota
2. beginning and finishing with the same sign
etc. users
aghata:....
roootr:....3. to contain what the least three... (1 Reply)
Discussion started by: ViruS89
1 Replies
6. Shell Programming and Scripting
Hi,
I need to know the difference between this commands:
grep * *search*
grep "*" *search*
As far as i know does the 2nd command search for files which have a name with *search* and greps then all which have chars from a-z in the file content.
But was does the first command??
Best... (1 Reply)
Discussion started by: xus
1 Replies
7. Shell Programming and Scripting
Hey im new in this...anything will be helpful...
The user will input the word or phrase .... I want to search the user input in file (by lines) but not all then with this line search on another file ( with the specific line) and show to the user.
Example:
file1.txt
=======
a
aa
aaa... (2 Replies)
Discussion started by: Sundown
2 Replies
8. UNIX Desktop Questions & Answers
Hello,
I am pretty new to UNIX and would like to know how i can run unix commands on a windows 7 machine. Basically, I want to practice running commands, created bash/awk/etc. scripts. I've read some things about cygwin, but it doesn't sound like it's exactly what I'm looking for.
Any... (4 Replies)
Discussion started by: tester213
4 Replies
9. Shell Programming and Scripting
I have a text file that has multiple lines in it with multiple dates and years. I was trying to figure out the best way to remove the line that had 2010 and 2011 to an archive file. We only need to keep the 2012 and 2013 lines in the original file. The following is a sample line in the txt file:... (2 Replies)
Discussion started by: smkremer
2 Replies
10. Shell Programming and Scripting
Oracle Linux 6.4/Bash shell
I have six files as shown below. Using ls/grep (or anything) , I need to list all files which start with the pattern stomper but not the ones
which ends with 1.
$ touch stompera
$ touch stomperb
$ touch stomperc
$ touch stompera1
$ touch stomperb1
$ touch... (7 Replies)
Discussion started by: kraljic
7 Replies
mktemp(3C) Standard C Library Functions mktemp(3C)
NAME
mktemp - make a unique file name from a template
SYNOPSIS
#include <stdlib.h>
char *mktemp(char *template);
DESCRIPTION
The mktemp() function replaces the contents of the string pointed to by template with a unique file name, and returns template. The string
in template should look like a file name with six trailing 'X's; mktemp() will replace the 'X's with a character string that can be used to
create a unique file name. Only 26 unique file names per thread can be created for each unique template.
RETURN VALUES
The mktemp() function returns the pointer template. If a unique name cannot be created, template points to a null string.
ERRORS
No errors are defined.
EXAMPLES
Example 1: Generate a filename.
The following example replaces the contents of the "template" string with a 10-character filename beginning with the characters "file" and
returns a pointer to the "template" string that contains the new filename.
#include <stdlib.h>
...
char *template = "/tmp/fileXXXXXX";
char *ptr;
ptr = mktemp(template);
USAGE
Between the time a pathname is created and the file opened, it is possible for some other process to create a file with the same name. The
mkstemp(3C) function avoids this problem and is preferred over this function.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
mkstemp(3C), tmpfile(3C), tmpnam(3C), attributes(5), standards(5)
SunOS 5.10 15 Sep 2004 mktemp(3C)