11-02-2010
If you do a man find, you'll notice that in order to print you need to use %p and terminate with a newline. printf is a GNU find only extension. You can accomplish the same thing with -exec , which will work with any find command. Hold on .. this should be in the homework forum
This User Gave Thanks to Scrutinizer For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi, i would like to extract the header and put it in a variable, then use printf to output the variable, but i keep on getting errors...please tell me if my format is incorrect.
HDR = "`ps -e -o user,pid,ppid,pcpu,stime,etime,time,comm | head -n 1`"
printf (%s, $HDR);
thanks! (3 Replies)
Discussion started by: laila63
3 Replies
2. Shell Programming and Scripting
Hi Folks!
Can you help me with this find -printf command. I seem to be unable to execute the printf-command from my shell script. I'm confused: :confused:
My shell script snippet looks like this:
#!/bin/sh
..
COMMAND="find ./* -printf '%p %m %s %u %g \n'"
echo "Command: ${COMMAND}"... (1 Reply)
Discussion started by: grahamb
1 Replies
3. Programming
What is the output of the following program considering an x86 based parameter passing sequence where stack grows towards lower memory addresses and that arguments are evaluated from right to left:
int i=10;
int f1()
{
static int i = 15;
printf("f1:%d ", i);
return i--;
}
main()
{... (2 Replies)
Discussion started by: arunviswanath
2 Replies
4. Shell Programming and Scripting
How to print output in following format?
A..................ok
AA................ok
AAA..............ok
AAAAAA........ok
"ok" one under one (4 Replies)
Discussion started by: mirusnet
4 Replies
5. Shell Programming and Scripting
Morning folks,
I need help with the following issue:
Let's say we I have the following output:
First Name: Test
Last Name: Test2
Number: T1234
Number2: T1234
Needed Output:
T1234
Now I want to grep/nawk/printf/sed out the Number: (13 Replies)
Discussion started by: domi55
13 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have just completed my first script (:D) and now i just need to format it with printf.
This is what I have:
#!/bin/ksh
TOTB=0
TOTF=0
TOTI=0
HOST=`hostname`
echo " FSYSTEM BLKS FREE INUSE MOUNTEDON"
df -m | grep -v ":"|grep -v Free|grep -v "/proc"| while read FSYSTEM... (2 Replies)
Discussion started by: compan023
2 Replies
7. UNIX for Dummies Questions & Answers
I have this command like that has %s in it, I know %s calls a column, but I am not sure I understand which column (I mean for my case I can check the input file, but I want to know how is this %s used, how comes tha same symbo; gives different columns in one command line:
{printf "grep %s... (22 Replies)
Discussion started by: cosmologist
22 Replies
8. Shell Programming and Scripting
If I enter (simplified):
find . -printf "%p\n"
then all files in the output are prepended by a "." like
./local/share/test23.log
How can achieve that
a.) the leading "./" is omitted
and/or
b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies
9. UNIX for Dummies Questions & Answers
printf "%5.5\n" "1234567890"
will print 12345 . How do I get it to print
67890
Essentially, I just want the last 5 characters rather than the first 5. (4 Replies)
Discussion started by: lavender
4 Replies
10. Shell Programming and Scripting
My current find command does not support printf.
I need find package that supports printf on AiX 6.1 system.
Can anyone help me with the download link or where / how / if I can find it ?
Can it be installed at a different non default location so that it can be reference without... (5 Replies)
Discussion started by: mohtashims
5 Replies
LEARN ABOUT OPENSOLARIS
hal-find-by-property
hal-find(1M) System Administration Commands hal-find(1M)
NAME
hal-find, hal-find-by-capability, hal-find-by-property - search HAL global device list
SYNOPSIS
hal-find-by-capability --capability capability [--help]
[--verbose] [--version]
hal-find-by-property --key key --string value [--help]
[--verbose] [--version]
DESCRIPTION
The hal-find commands, hal-find-by-capability and hal-find-by-property, search the Hardware Abstraction Layer (HAL) device list by speci-
fied criteria and displays results on the standard output. hal-find-by-capability searches by capability, such as volume or block. hal-
find-by-property searches by property, such as block.is_volume or volume.disc.has_audio.
OPTIONS
The following options are supported:
--capability capability HAL device capability to search for.
--help Display list of options.
--key key The key to the property that is the basis of the search.
--string value The string value associated with the property that is the basis of the search.
--verbose Verbose mode.
--version Display version and exit.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWhalr |
+-----------------------------+-----------------------------+
|Interface Stability |Volatile |
+-----------------------------+-----------------------------+
SEE ALSO
hald(1M), attributes(5), hal(5)
SunOS 5.11 22 Aug 2006 hal-find(1M)