I have a script like this--
#!/bin/ksh
echo "To pad a 0 before digits from 1-9"
for i in $*
do
echo $i | sed 's//'0'/g'
done
I run this script as
ksh name 1 2 23 34
The output should be
01 02 23 34
Help me in modifying this script.
Thanks
Namish (2 Replies)
Folks,
Is there a simple way to replace one digit by two digit using sed.
Example,
mydigit1918_2006_8_8_lag1.csv should be
mydigit1918_2006_08_08_lag01.csv.
I tried this way, but doesn't work.
echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/'
Thank you, (5 Replies)
Hi All,
How can i convert a number 24 to 0024
In the same way how can i convert 123 to 0123?
All this has to be done inside a script
Thanks in advance
JS (6 Replies)
hi all,
how do i format the date command so it displays day and month in single digits i.e 8 instead of 08 ??
am using the command (in a ksh) : date +%D
output i get is 10/08/08
thanks in advance. (5 Replies)
hi all,
how do i get the month in single digit in ksh script ?? my command for date is :
/usr/bin/date +%Om/%Oe/%y | sed 's/ //g'
which returns "01/16/09" but i need the output to be "1/16/09" i.e the month without leading zero.
thanks in advance. (2 Replies)
I have a var storing date
var=`date`
Now the date is returned as
Mon Feb 2 00:25:48 PST 2009
Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var"
My intention in above case is... (3 Replies)
Hi ,
how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example
pattern file pattern.txt
pattern num
bala 2
raja 3
muthu 4
File Name: chennai.dat
muthu is good boy
raja is bad boy
selvam in super... (6 Replies)
Hi,
I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line,
if it starts with 2 or more digits then i have to keep the line
Here is a sample of my file:
377 CARRER DE LA... (5 Replies)
Hi All,
I have a file which keeps count based on completion of a certain activity. I am using the following grep command to return a '1' in case the count is zero
grep -ic "0" abc_count.txt
Now the issue happens when the count is '10', '20' etc .. in these cases as well it returns a... (5 Replies)
Discussion started by: dev.devil.1983
5 Replies
LEARN ABOUT OSX
memberd
dsmemberutil(1) BSD General Commands Manual dsmemberutil(1)NAME
dsmemberutil -- various operations for the membership APIs, including state dump, check memberships, UUIDs, etc.
SYNOPSIS
dsmemberutil [-v] [-h] command [options]
DESCRIPTION
dsmemberutil is a program that implements the membership API calls in a command line utility.
FLAGS
A list of flags and their descriptions:
-h Lists the options for calling dsmemberutil
-v Causes dsmemberutil to operate in verbose mode.
COMMANDS
The action of each command is described below:
getuuid -ugUGsS value
Takes any of the options and returns the associated UUID.
getid -UGsSX value
Takes any of the options and returns the associated UID or GID depending on option provided.
getsid -ugUGX value
Takes any of the options and returns the associated SID.
checkmembership -uUxs param -gGXS param
Returns if a user or group with the associated option is a member of the group.
flushcache Flushes the current membership cache.
Legacy commands such as dumpstate and statistics are gone. See odutil(1) for show cache and statistics operations.
A list of options available. In some cases -xX and -sS can be used synonymously due to nature of the value.
-u uid Using user with UID
-U name Using user with name
-s sid Using user with SID
-x uuid Using user with UUID
-g gid Using group with GID
-G name Using group with name
-S sid Using group with SID
-X uuid Using group with UUID
EXAMPLES
Get a user's uuid:
% dsmemberutil getuuid -u 501
EEA4F2F6-B268-49E7-9C6F-E3C4A37DA4FD
Get a group's uuid
% dsmemberutil getuuid -g 0
ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000000
Get a user's or group's id from a uuid
% dsmemberutil getid -X ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C
gid: 12
Check a user's membership in a group (using UID and GID)
% dsmemberutil checkmembership -u 501 -g 0
user is not a member of the group
Check a user's membership in a group (using names)
% dsmemberutil checkmembership -U root -G wheel
user is a member of the group
SEE ALSO odutil(1), dseditgroup(1), dscacheutil(1)Darwin Jan 1, 2007 Darwin