Sponsored Content
Top Forums UNIX for Beginners Questions & Answers UNIX Environment Setup - (Just starting!) Post 303036483 by bakunin on Friday 28th of June 2019 11:33:19 AM
Old 06-28-2019
First off: thanks for the praise. I am sure most of the others would have told you the same, i was probably just the one typing the fastest. ;-)
A few (unsorted) extra points and clarifications:

- reading man pages
This is an extremely helpful skill, because man pages are a treasure trove of information, unfortunately written in a style that needs getting used to. I guarantee you that you will for the first three months wonder why everybody is emphasizing them. For the rest of your life, though, you will wonder how you could get so old without having had access to them. They are, essentially, a reference: you find everything there if you know what you search for. I consult them several dozens of times every day (there is absolutely no shame in knowing where to search) and you will do the same (like everybody else working on a UNIX system does).

- regular expressions
Basically they are specialised mini-languages to describe text patterns. Notice, that there are several flavors of them and you don't know all the differences but you should - from the beginning - be aware that there these flavors. Since they work the same in different tools (grep: BRE, awk: ERE, sed: BRE, egrep/"grep -e": ERE, ...) learning them makes you learn several essential tools at once. Have a look at the "Shell scripting" forum and you will notice that two out of three (if not even more) threads deal with the mentioned tools.

Finally, my personal book recommendations:

"sed & awk" by Dale Dougherty, published at O'Reilly
"Hand-On Korn Shell 93 Programming" by Barry Rosenberg (perhaps the funniest and wittiest computer book i ever had the pleasure to read)
"The AIX Survival Guide" by Andreas Siegert is a bit aged, but it still sits on my work desk daily if that means anything. I have three copies of it and every bit of spare space filled with annotations by me. Two copies are so worn down i bought a third one for daily use just to make them last longer.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

starting unix

I was wondering if there is a unix version of an autoexec.bat, if there is where will it be? I am new to unix so please be gentle!! (9 Replies)
Discussion started by: imshelpdesk
9 Replies

2. UNIX for Dummies Questions & Answers

starting out in unix

i am trying to learn cgi script (perl), i think to do this i need to download a unix system,/acccount, which i have tried to do on XP without success. Can any one point me in the right direction on how i get started. i.e what do i need to do to actually write cgi script for my website. cheers... (4 Replies)
Discussion started by: rerkskin
4 Replies

3. UNIX for Dummies Questions & Answers

How To Setup Unix In Pc

Hi, I am new to this forum, and i am trying to learn unix at my home, i do have desk top, and installed windows, also the hard disk space is 80GB, so please guide me , advise me for how to proceed. Your help is needed. Thank you in advance. Aksha. *** email deleted *** (3 Replies)
Discussion started by: akshamani
3 Replies

4. AIX

NIM server setup on etherchannel setup environment

I know that IBM's official stance is that NIM does not work on etherchannel environment, but has anyone able to get around it? I'm working on a p5-590 LPAR system, and the NIM master and clients are all on the same frame. Any help is appreciated. (1 Reply)
Discussion started by: pdtak
1 Replies

5. Shell Programming and Scripting

Need help!! Am just starting to learn UNIX

Dear ALL! i have just started learing UNIX. Can anyone pls let me how to write a program using command line to give product of two numbers ? The program should ask like enter first no and so on. Also,i want to know a program which can display the digits entered in words. Like if entered "1"... (2 Replies)
Discussion started by: chature
2 Replies

6. UNIX for Advanced & Expert Users

Setup a Fully Featured C++ Develop Environment

Hello, I'm learning C++ and i want to know what i have to do for setup a fully featured C++ develop environment in my Ubuntu Intrepid Ibex, like Gedit, because i hate eMacs and non-graphical editors, they are so much confusing, and some other things that will help me with my development. ... (7 Replies)
Discussion started by: nathanpc
7 Replies

7. Shell Programming and Scripting

How to send email using shell script in UNIX, Is any environment setup required in Mac OS X ?

Hi All, I am using Mac OS X (Leopard OS). I am very new to UNIX. My requirement is that, by running a shell script, I create a log file. So I have to send a mail having that log file attached. What I tried to do is, I simply tried to check,whether this direct command works or not. So I... (2 Replies)
Discussion started by: Afreen
2 Replies

8. UNIX for Dummies Questions & Answers

Samba setup in virtual server environment Windows/ Linux

I have a home network set up that consists of a few windows clients and 3 centos, and 1 suse client. These are all virtual machines, VMware Workstation. One centos vm is set to be the Samba server. Do I need Samba set up on the other Linux clients?I have no problem seeing the windows clients... (0 Replies)
Discussion started by: ktb231
0 Replies

9. Solaris

Setup print environment in Solaris 11

Hi Experts, Please help me on this. I've a print environment using NIS in Solaris 10. Recently we have new JDE environment which using Solaris 11 OS, and found that we can't use NIS anymore. So only the option is using CUPS. How do we integrate this print environment for both Solaris 10... (9 Replies)
Discussion started by: srigias
9 Replies

10. UNIX for Beginners Questions & Answers

UNIX Environment Setup - (Just starting!)

Morning All So, I am starting looking into the world of UNIX for a new job (luckily not my primary function!) and I am looking to get stared. Like anything I seem to learn best by trying things out first in an environment but I have a key question: Currently I use Oracle VirtualBox, can... (1 Reply)
Discussion started by: harveyclayton
1 Replies
GREP(1P)						     POSIX Programmer's Manual							  GREP(1P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
grep - search a file for a pattern SYNOPSIS
grep [-E| -F][-c| -l| -q][-insvx] -e pattern_list... [-f pattern_file]...[file...] grep [-E| -F][-c| -l| -q][-insvx][-e pattern_list]... -f pattern_file...[file...] grep [-E| -F][-c| -l| -q][-insvx] pattern_list[file...] DESCRIPTION
The grep utility shall search the input files, selecting lines matching one or more patterns; the types of patterns are controlled by the options specified. The patterns are specified by the -e option, -f option, or the pattern_list operand. The pattern_list's value shall con- sist of one or more patterns separated by <newline>s; the pattern_file's contents shall consist of one or more patterns terminated by <new- line>. By default, an input line shall be selected if any pattern, treated as an entire basic regular expression (BRE) as described in the Base Definitions volume of IEEE Std 1003.1-2001, Section 9.3, Basic Regular Expressions, matches any part of the line excluding the termi- nating <newline>; a null BRE shall match every line. By default, each selected input line shall be written to the standard output. Regular expression matching shall be based on text lines. Since a <newline> separates or terminates patterns (see the -e and -f options below), regular expressions cannot contain a <newline>. Similarly, since patterns are matched against individual lines (excluding the ter- minating <newline>s) of the input, there is no way for a pattern to match a <newline> found in the input. OPTIONS
The grep utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines. The following options shall be supported: -E Match using extended regular expressions. Treat each pattern specified as an ERE, as described in the Base Definitions volume of IEEE Std 1003.1-2001, Section 9.4, Extended Regular Expressions. If any entire ERE pattern matches some part of an input line excluding the terminating <newline>, the line shall be matched. A null ERE shall match every line. -F Match using fixed strings. Treat each pattern specified as a string instead of a regular expression. If an input line contains any of the patterns as a contiguous sequence of bytes, the line shall be matched. A null string shall match every line. -c Write only a count of selected lines to standard output. -e pattern_list Specify one or more patterns to be used during the search for input. The application shall ensure that patterns in pattern_list are separated by a <newline>. A null pattern can be specified by two adjacent <newline>s in pattern_list. Unless the -E or -F option is also specified, each pattern shall be treated as a BRE, as described in the Base Definitions volume of IEEE Std 1003.1-2001, Section 9.3, Basic Regular Expressions. Multiple -e and -f options shall be accepted by the grep utility. All of the specified patterns shall be used when matching lines, but the order of evaluation is unspecified. -f pattern_file Read one or more patterns from the file named by the pathname pattern_file. Patterns in pattern_file shall be terminated by a <new- line>. A null pattern can be specified by an empty line in pattern_file. Unless the -E or -F option is also specified, each pattern shall be treated as a BRE, as described in the Base Definitions volume of IEEE Std 1003.1-2001, Section 9.3, Basic Regular Expres- sions. -i Perform pattern matching in searches without regard to case; see the Base Definitions volume of IEEE Std 1003.1-2001, Section 9.2, Regular Expression General Requirements. -l (The letter ell.) Write only the names of files containing selected lines to standard output. Pathnames shall be written once per file searched. If the standard input is searched, a pathname of "(standard input)" shall be written, in the POSIX locale. In other locales, "standard input" may be replaced by something more appropriate in those locales. -n Precede each output line by its relative line number in the file, each file starting at line 1. The line number counter shall be reset for each file processed. -q Quiet. Nothing shall be written to the standard output, regardless of matching lines. Exit with zero status if an input line is selected. -s Suppress the error messages ordinarily written for nonexistent or unreadable files. Other error messages shall not be suppressed. -v Select lines not matching any of the specified patterns. If the -v option is not specified, selected lines shall be those that match any of the specified patterns. -x Consider only input lines that use all characters in the line excluding the terminating <newline> to match an entire fixed string or regular expression to be matching lines. OPERANDS
The following operands shall be supported: pattern_list Specify one or more patterns to be used during the search for input. This operand shall be treated as if it were specified as -e pattern_list. file A pathname of a file to be searched for the patterns. If no file operands are specified, the standard input shall be used. STDIN
The standard input shall be used only if no file operands are specified. See the INPUT FILES section. INPUT FILES
The input files shall be text files. ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of grep: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_COLLATE Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements within regular expres- sions. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files) and the behavior of character classes within regular expressions. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES . ASYNCHRONOUS EVENTS
Default. STDOUT
If the -l option is in effect, and the -q option is not, the following shall be written for each file containing at least one selected input line: "%s ", <file> Otherwise, if more than one file argument appears, and -q is not specified, the grep utility shall prefix each output line by: "%s:", <file> The remainder of each output line shall depend on the other options specified: * If the -c option is in effect, the remainder of each output line shall contain: "%d ", <count> * Otherwise, if -c is not in effect and the -n option is in effect, the following shall be written to standard output: "%d:", <line number> * Finally, the following shall be written to standard output: "%s", <selected-line contents> STDERR
The standard error shall be used only for diagnostic messages. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
The following exit values shall be returned: 0 One or more lines were selected. 1 No lines were selected. >1 An error occurred. CONSEQUENCES OF ERRORS
If the -q option is specified, the exit status shall be zero if an input line is selected, even if an error was detected. Otherwise, default actions shall be performed. The following sections are informative. APPLICATION USAGE
Care should be taken when using characters in pattern_list that may also be meaningful to the command interpreter. It is safest to enclose the entire pattern_list argument in single quotes: '...' The -e pattern_list option has the same effect as the pattern_list operand, but is useful when pattern_list begins with the hyphen delim- iter. It is also useful when it is more convenient to provide multiple patterns as separate arguments. Multiple -e and -f options are accepted and grep uses all of the patterns it is given while matching input text lines. (Note that the order of evaluation is not specified. If an implementation finds a null string as a pattern, it is allowed to use that pattern first, matching every line, and effectively ignore any other patterns.) The -q option provides a means of easily determining whether or not a pattern (or string) exists in a group of files. When searching sev- eral files, it provides a performance improvement (because it can quit as soon as it finds the first match) and requires less care by the user in choosing the set of files to supply as arguments (because it exits zero if it finds a match even if grep detected an access or read error on earlier file operands). EXAMPLES
1. To find all uses of the word "Posix" (in any case) in file text.mm and write with line numbers: grep -i -n posix text.mm 2. To find all empty lines in the standard input: grep ^$ or: grep -v . 3. Both of the following commands print all lines containing strings "abc" or "def" or both: grep -E 'abc|def' grep -F 'abc def' 4. Both of the following commands print all lines matching exactly "abc" or "def" : grep -E '^abc$|^def$' grep -F -x 'abc def' RATIONALE
This grep has been enhanced in an upwards-compatible way to provide the exact functionality of the historical egrep and fgrep commands as well. It was the clear intention of the standard developers to consolidate the three greps into a single command. The old egrep and fgrep commands are likely to be supported for many years to come as implementation extensions, allowing historical appli- cations to operate unmodified. Historical implementations usually silently ignored all but one of multiply-specified -e and -f options, but were not consistent as to which specification was actually used. The -b option was omitted from the OPTIONS section because block numbers are implementation-defined. The System V restriction on using - to mean standard input was omitted. A definition of action taken when given a null BRE or ERE is specified. This is an error condition in some historical implementations. The -l option previously indicated that its use was undefined when no files were explicitly named. This behavior was historical and placed an unnecessary restriction on future implementations. It has been removed. The historical BSD grep -s option practice is easily duplicated by redirecting standard output to /dev/null. The -s option required here is from System V. The -x option, historically available only with fgrep, is available here for all of the non-obsolescent versions. FUTURE DIRECTIONS
None. SEE ALSO
sed COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 GREP(1P)
All times are GMT -4. The time now is 02:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy