Sponsored Content
Full Discussion: Reverse *
Top Forums Shell Programming and Scripting Reverse * Post 70127 by Ygor on Tuesday 26th of April 2005 03:40:40 AM
Old 04-26-2005
You could create a function, e.g...
Code:
function myls {
  ls $(echo $1 | awk '{for(x=length;x>=1;x--)print substr($0,1,x) "*"}')
}

Then you can use...

$ myls ztr
ls: ztr*: No such file or directory
ls: zt*: No such file or directory
ls: z*: No such file or directory
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reverse Display

I need to display a line in an xterm window but i want to revese the colors so that the background color becomes the foreground color and the foreground color the background color. I want to do this as part of ksh script. Can somebody tell me how to do this ? Thanks, Abu. (5 Replies)
Discussion started by: marcose
5 Replies

2. Shell Programming and Scripting

reverse of basename

Hi, Can someone let me know how to find the reverse of the basename i.e i have /apps/tiv/pmon/xxxx.dat and I want /apps/tiv/pmon/ Thanks (7 Replies)
Discussion started by: braindrain
7 Replies

3. Shell Programming and Scripting

Reverse FTP

Hi Everybody, I want to write a script in unix which will automatically FTP a .txt file from my client machine D: drive(Windows) That is I want to FTP a file from my PC to UNIX box but this should be done from UNIX box by a shell script. (i.e. I will invoke the script in UNIX and FTP will be... (4 Replies)
Discussion started by: ganesh123
4 Replies

4. Shell Programming and Scripting

reverse sort

Hello, How do i sort a csv file. i should be sorting column1(varchar),column2*(varchar) in ascending and column4 in descending order(numeric datatype). I tried few combinations of sort, but doesn't seem to be getting the right result. sort -t "," -k 1 -k 2 -k 4nr file any help is... (3 Replies)
Discussion started by: markjason
3 Replies

5. Shell Programming and Scripting

Reverse multiword

Just check out the script... 1 #!/bin/bash 2 3 echo -n "Enter a string :: " 4 read str 5 echo -n "Reverse is :: " 6 l=`expr length "$str"` 7 while 8 do 9 m=`echo $str | cut -c "$l"` 10 echo -n $m 11 ... (3 Replies)
Discussion started by: lipun4u
3 Replies

6. Shell Programming and Scripting

reverse matching

Hello guys How can I use egrep to match word1 but not word2...word1. What I mean suppose that I have the following text, and my word1=pizza and word2=eat I hate to eat pizza because I ma eating it each day Pizza is good I like vegetarian and Italian Pizza eating healthy food is... (7 Replies)
Discussion started by: fdc2suxs
7 Replies

7. Shell Programming and Scripting

Reverse of a string

Hi All, I have a String str="Manish". I would like to reverse it. I know the option to do this in bash is: echo "Manish" | rev but I have seen an alternate solution somewhere, which states that: str="Manish" echo $str | awk '{ for(i=length($0);i>=1;i--) printf("%s",substr($0,i,1));... (7 Replies)
Discussion started by: manishdivs
7 Replies

8. Shell Programming and Scripting

Reverse sort

Hello, I have a large list of names and would like to do a reverse sort on them i.e. the sort should be by the ending and not by the beginning of the word. I had written in awk a small script but it does wrong things { for(i=length($0);i>=1;i--) printf("%s/n",substr($0,i,1)); } Could anyone... (3 Replies)
Discussion started by: gimley
3 Replies

9. Shell Programming and Scripting

Reverse even lines

I'm trying to reverse every even line in my file using the awk command below but it prints only the odd lines but nothing else: $ awk '(NR % 2) {print}; !(NR % 2) {print | "rev";}' myfile Any idea what I might have done wrong? Thank you. (10 Replies)
Discussion started by: ivpz
10 Replies
DLM_CREATE_LOCKSPACE(3) 				     Library Functions Manual					   DLM_CREATE_LOCKSPACE(3)

NAME
dlm_create_lockspace, dlm_open_lockspace, dlm_close_lockspace, dlm_release_lockspace - manipulate DLM lockspaces SYNOPSIS
#include <libdlm.h> dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode); dlm_lshandle_t dlm_new_lockspace(const char *name, mode_t mode, uint32_t flags); dlm_lshandle_t dlm_open_lockspace(const char *name); int dlm_close_lockspace(dlm_lshandle_t ls); int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force); DESCRIPTION
The DLM allows locks to be partitioned into "lockspaces", and these can be manipulated by userspace calls. It is possible (though not rec- ommended) for an application to have multiple lockspaces open at one time. Many of the DLM calls work on the "default" lockspace, which should be fine for most users. The calls with _ls_ in them allow you to iso- late your application from all others running in the cluster. Remember, lockspaces are a cluster-wide resource, so if you create a lockspace called "myls" it will share locks with a lockspace called "myls" on all nodes. These calls allow users to create & remove lockspaces, and users to connect to existing lockspace to store their locks there. dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode); This creates a lockspace called <name> and the mode of the file user to access it will be <mode> (subject to umask as usual). The lockspace must not already exist on this node, if it does -1 will be returned and errno will be set to EEXIST. If you really want to use this lockspace you can then use dlm_open_lockspace() below. The name is the name of a misc device that will be created in /dev/misc. On success a handle to the lockspace is returned, which can be used to pass into subsequent dlm_ls_lock/unlock calls. Make no assumptions as to the content of this handle as it's content may change in future. The caller must have CAP_SYSADMIN privileges to do this operation. Return codes: 0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following: EINVAL An invalid parameter was passed to the call ENOMEM A (kernel) memory allocation failed EEXIST The lockspace already exists EPERM Process does not have capability to create lockspaces ENOSYS A fatal error occurred initializing the DLM Any error returned by the open() system call int dlm_new_lockspace(const char *name, mode_t mode, uint32_t flags) Performs the same function as dlm_create_lockspace() above, but passes some creation flags to the call that affect the lockspace being cre- ated. Currently supported flags are: DLM_LSFL_NODIR the lockspace should not use a resource directory DLM_LSFL_TIMEWARN the dlm should emit warnings over netlink when locks have been waiting too long; required for deadlock detection int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force) Deletes a lockspace. If the lockspace still has active locks then -1 will be returned and errno set to EBUSY. Both the lockspace handle /and/ the name must be specified. This call also closes the lockspace and stops the thread associated with the lockspace, if any. Note that other nodes in the cluster may still have locks open on this lockspace. This call only removes the lockspace from the current node. If the force flag is set then the lockspace will be removed even if another user on this node has active locks in it. Existing users will NOT be notified if you do this, so be careful. The caller must have CAP_SYSADMIN privileges to do this operation. Return codes: 0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following: EINVAL An invalid parameter was passed to the call EPERM Process does not have capability to release lockspaces EBUSY The lockspace could not be freed because it still contains locks and force was not set. dlm_lshandle_t dlm_open_lockspace(const char *name) Opens an already existing lockspace and returns a handle to it. Return codes: 0 is returned if the call completed successfully. If not, -1 is returned and errno is set to an error returned by the open() system call int dlm_close_lockspace(dlm_lshandle_t ls) Close the lockspace. Any locks held by this process will be freed. If a thread is associated with this lockspace then it will be stopped. Return codes: 0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following: EINVAL lockspace was not a valid lockspace handle SEE ALSO
libdlm(3), dlm_unlock(3), dlm_lock(3), libdlm functions July 5, 2007 DLM_CREATE_LOCKSPACE(3)
All times are GMT -4. The time now is 04:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy