Sponsored Content
Top Forums Shell Programming and Scripting Difference between "?" and "*" Post 302213459 by krishmaths on Thursday 10th of July 2008 06:45:46 AM
Old 07-10-2008
@gaurang:

Remember that you are doing a grep. That means the command will list down lines from the file that match the input pattern.

In this case egrep works on your patterns a? and a* in the following way.

egrep a? --> List down lines from test.txt if it contains an a followed by any character. Which means a, aa, abcdef, a897 all will match, and hence you get all these in the output.

egrep a* --> List down lines from test.txt if it contains an a followed by 0 or more nr of characters. Again a, aa, abcdef, a897 all will match.

Hope you get the point.

Moreover, to see the difference between ? and *, create files with names : a, aa, a897, abcd
and then do
Code:
ls a?

and
Code:
ls a*

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

3. Solaris

difference between "root" and "usr" packages

Hi, could someone pls enlighten me on the difference between the "root" package and "usr" package? Like in this example: pkginfo -l SUNWGtku | grep -i desc DESC: GTK - The GIMP Toolkit (Usr) and pkginfo -l SUNWGtkr | grep -i desc DESC: GTK - The GIMP Toolkit (Root)... (6 Replies)
Discussion started by: masloff
6 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
ippfind(1)							    Apple Inc.								ippfind(1)

NAME
ippfind - find internet printing protocol printers SYNOPSIS
ippfind [ options ] regtype[,subtype][.domain.] ... [ expression ... ] ippfind [ options ] name[.regtype[.domain.]] ... [ expression ... ] ippfind --help ippfind --version DESCRIPTION
ippfind finds services registered with a DNS server or available through local devices. Its primary purpose is to find IPP printers and show their URIs, show their current status, or run commands. REGISTRATION TYPES ippfind supports the following registration types: _http._tcp HyperText Transport Protocol (HTTP, RFC 2616) _https._tcp Secure HyperText Transport Protocol (HTTPS, RFC 2818) _ipp._tcp Internet Printing Protocol (IPP, RFC 2911) _ipps._tcp Secure Internet Printing Protocol (IPPS, draft) _printer._tcp Line Printer Daemon (LPD, RFC 1179) EXPRESSIONS ippfind supports expressions much like the find(1) utility. However, unlike find(1), ippfind uses POSIX regular expressions instead of shell filename matching patterns. If --exec, -l, --ls, -p, --print, --print-name, -q, --quiet, -s, or -x is not specified, ippfind adds --print to print the service URI of anything it finds. The following expressions are supported: -d regex --domain regex True if the domain matches the given regular expression. --false Always false. -h regex --host regex True is the hostname matches the given regular expression. -l --ls Lists attributes returned by Get-Printer-Attributes for IPP printers and traditional find "-ls" output for HTTP URLs. The result is true if the URI is accessible, false otherwise. --local True if the service is local to this computer. -N name --literal-name name True if the service instance name matches the given name. -n regex --name regex True if the service instance name matches the given regular expression. --path regex True if the URI resource path matches the given regular expression. -P number[-number] --port number[-number] True if the port matches the given number or range. -p --print Prints the URI if the result of previous expressions is true. The result is always true. -q --quiet Quiet mode - just returns the exit codes below. -r --remote True if the service is not local to this computer. -s --print-name Prints the service instance name if the result of previous expressions is true. The result is always true. --true Always true. -t key --txt key True if the TXT record contains the named key. --txt-key regex True if the TXT record contains the named key and matches the given regular expression. -u regex --uri regex True if the URI matches the given regular expression. -x utility [ argument ... ] ; --exec utility [ argument ... ] ; Executes the specified program if the current result is true. "{foo}" arguments are replaced with the corresponding value - see SUB- STITUTIONS below. Expressions may also contain modifiers: ( expression ) Group the result of expressions. ! expression --not expression Unary NOT of the expression. expression expression expression --and expression Logical AND of expressions. expression --or expression Logical OR of expressions. SUBSTITUTIONS The substitutions for "{foo}" in -e and --exec are: {service_domain} Domain name, e.g., "example.com.", "local.", etc. {service_hostname} Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. {service_name} Service instance name, e.g., "My Fine Printer". {service_port} Port number for server, typically 631 for IPP and 80 for HTTP. {service_regtype} DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. {service_scheme} URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. {} {service_uri} URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. {txt_key} Value of TXT record key (lowercase). OPTIONS
ippfind supports the following options: --help Show program help. --version Show program version. -4 Use IPv4 when listing. -6 Use IPv6 when listing. -T seconds Specify find timeout in seconds. If 1 or less, ippfind stops as soon as it thinks it has found everything. The default timeout is 1 second. -V version Specifies the IPP version when listing. Supported values are "1.1", "2.0", "2.1", and "2.2". EXIT STATUS
ippfind returns 0 if the result for all processed expressions is true, 1 if the result of any processed expression is false, 2 if browsing or any query or resolution failed, 3 if an undefined option or invalid expression was specified, and 4 if it ran out of memory. ENVIRONMENT
When executing a program, ippfind sets the following environment variables for the matching service registration: IPPFIND_SERVICE_DOMAIN Domain name, e.g., "example.com.", "local.", etc. IPPFIND_SERVICE_HOSTNAME Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. IPPFIND_SERVICE_NAME Service instance name, e.g., "My Fine Printer". IPPFIND_SERVICE_PORT Port number for server, typically 631 for IPP and 80 for HTTP. IPPFIND_SERVICE_REGTYPE DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. IPPFIND_SERVICE_SCHEME URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. IPPFIND_SERVICE_URI URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. IPPFIND_TXT_KEY Values of TXT record KEY (uppercase). EXAMPLES
To show the status of all registered IPP printers on your network, run: ippfind --ls Similarly, to send a PostScript test page to every PostScript printer, run: ippfind --txt-pdl application/postscript --exec ipptool -f onepage-letter.ps '{}' print-job.test ; SEE ALSO
ipptool(1) COPYRIGHT
Copyright (C) 2013-2018 by Apple Inc. 14 February 2018 CUPS ippfind(1)
All times are GMT -4. The time now is 12:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy