Sponsored Content
Full Discussion: Help needed in unix commands
Top Forums Shell Programming and Scripting Help needed in unix commands Post 302449968 by malikshahid85 on Wednesday 1st of September 2010 05:34:12 AM
Old 09-01-2010
Quote:
Originally Posted by anchal_khare
Better to define the function inside the awk.
something like:


Code:
$ cat y
test,   test2,   test3   ,test4
test,   test2,   test3   ,test4
test,   test2,   test3   ,test4
test,   test2,   test3   ,test4
$ 
$ 
$ 
$ cat mm
awk -F, '
 
function TrimSpace(mystr)
 {
  tstr=mystr;
  sub(/^[ \t\n]*/,"",tstr);
  sub(/[ \t\n]*$/,"",tstr);
  return tstr
 }
 
{print TrimSpace($2)}' y
$ 
$ 
$ 
$ ./mm
test2
test2
test2
test2
$

thanks for reply

but actually i want to know the possibility of calling an outside function within nawk
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix help needed!

I have a few questions about Unix. Can you please help! 1.How do I create an alias that greps the password file for my username and returns my password file entry? Once I get the alias to work I want to be able to let a friend use it .So that he can use the alias to locate his password entry... (1 Reply)
Discussion started by: JJJ
1 Replies

2. UNIX for Dummies Questions & Answers

Maingrame to UNIX sending UNIX commands

I want to know if there is a way to send unix commands thru FTP from a mainframe to kick off Autosys Jobs. I just need to send a command from the mainframe to UNIX and have UNIX execute that command. (2 Replies)
Discussion started by: skammer
2 Replies

3. UNIX for Dummies Questions & Answers

Unix help needed !!

friends i wanted to now whehter there exists a book as a solution to the questions posted in exercies of the Design of Unix Operating system by Maurice J Bach !..its really urgent !! (1 Reply)
Discussion started by: darshaan
1 Replies

4. Shell Programming and Scripting

unix manual needed :)

hi guys... am new 2 dis unix world... am in need of a unix manual... cud sum1 pls post sum links 2 download it?>?>? :confused: Danks in advance... ;) ;) ;) (1 Reply)
Discussion started by: sundar_shankar
1 Replies

5. UNIX for Dummies Questions & Answers

Running UNIX commands remotely in Windows box from Unix box – avoid entering password

I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked. Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies

6. Shell Programming and Scripting

Help needed in some unix commands

Hi, Solutions may be in ksh or bash 1. i have some files like. CAT_CO00102_20100816190955.Z CAT_CO00102_20100816190955Q.Z CAT_CO00202_20100825135947A.Z to find out files ends with A.Z or Q.Z i use following in ksh. CAT="CAT*.Z" ls $CAT CAT_CO00102_20100816190955Q.Z ... (5 Replies)
Discussion started by: malikshahid85
5 Replies

7. Solaris

Help needed - trying to run commands in Guest LDoms from Control LDOM

Hi Folks, I am used to writing scripts to get info by running commands at local zones level from their respective global zone by using zlogin <localzone> "command>" while remaining at the global zone level. Can the same be done with Guest LDoms while remaining at the control LDOM level? ... (4 Replies)
Discussion started by: momin
4 Replies

8. Homework & Coursework Questions

Unix Homework Help needed

1 Petras Pavardenis 1980 5 08 Linas Bajoriunas 1970 10 3 Saulius Matikaitis 1982 2 5 Mindaugas Stulgis 1990 7 6 Rimas Nasickis 1964 10 7 ... (1 Reply)
Discussion started by: vaidastf
1 Replies

9. Shell Programming and Scripting

Linux Commands needed for replacing variable number of spaces with a single , in a txt file

Hi I want to read a text file and replace various number of spaces between each string in to a single "," or any other character .Please let me know the command to do so. My input file is a txt file which is the output of a SQL table extract so it contains so many spaces between each column of the... (2 Replies)
Discussion started by: Hari Prasanth
2 Replies

10. Homework & Coursework Questions

Help needed - UNIX command

The 'env' command prints out all of the environment variables and their values. Come up with a command that prints a list of environment variables whose names end with either 'NAME', 'DIR' or 'PATH'. What I've tried. $ env | grep '' Although it highlights the part of the variables... (8 Replies)
Discussion started by: edujs7
8 Replies
DwtOpenHierarchy(3Dwt)													    DwtOpenHierarchy(3Dwt)

Name
       DwtOpenHierarchy - Allocates a hierarchy ID and opens all the UID files in the hierarchy.

Syntax
       #include <X11/DwtAppl.h>
       Cardinal DwtOpenHierarchy(num_files, file_names_list, ancillary_structures_list,
				 hierarchy_id_return)
	    DRMCount num_files;
	    String file_names_list [];
	    IDBOSOpenParamPtr *ancillary_structures_list;
	    DRMHierarchy *hierarchy_id_return;

Arguments
       num_files Specifies the number of files in the name list.

       file_names_list
		 Specifies an array of pointers to character strings that identify the .uid files.

       ancillary_structures_list
		 A list of operating system-dependent ancillary structures corresponding to such things as file names, clobber flag, and so forth.
		 This argument should be NULL for most operations.  If you need to reference this structure,  see  the	definition  of	IDBOSOpen-
		 ParamPtr in DwtAppl.h for more information.

       hierarchy_id_return
		 Returns  the search hierarchy ID.  The search hierarchy ID identifies the list of .uid files that DRM will search (in order) when
		 performing subsequent fetch calls.

Description
       The DwtOpenHierarchy function allows the user to specify the list of UID files that DRM will search in subsequent  fetch  operations.   All
       subsequent  fetch  operations  will  return  the first occurrence of the named item encountered while traversing the UID hierarchy from the
       first list element (UID file specification) to the last list element.  This function also allocates a hierarchy ID and opens  all  the  UID
       files  in the hierarchy.  It initializes the optimized search lists in the hierarchy.  If DwtOpenHierarchy encounters any errors during its
       execution, any files that were opened are closed.

       Each UID file specified in file_names_list can specify either a full directory pathname or a file name.	If a UID file does not specify the
       pathname it will not contain any embedded slashes (/),  and it will be accessed through the UIDPATH environment variable.

       The  UIDPATH environment variable specifies search paths and naming conventions associated with UID files.  It can contain the substitution
       fields %L and %N, where the current setting of the LANG environment variable is substituted for %L and the .uid name passed to DwtOpenHier-
       archy  is  substituted  for  %N.   For  example, the following UID path and DwtOpenHierarchy call would cause DRM to open two separate .uid
       files:

	UIDPATH=/uidlib/%L/%N.uid:/uidlib/%N/%L
	 static char *uid_files[] = {"/usr/users/me/test.uid", "test2"};
	  DRMHierarchy	*Hierarchy_id;
	  DwtOpenHierarchy((DRMCount)2,uid_files, NULL, Hierarchy_id)

       The first file, /usr/users/me/test.uid, would be opened as specified, as this file specification includes a  pathname.	The  second  file,
       test2, would be looked for first in /uidlib/$LANG/test2.uid, and second in /uidlib/test2/$LANG.

       After  DwtOpenHierarchy opens the UID hierarchy, you should not delete or modify the UID files until you close the UID hierarchy by calling
       DwtCloseHierarchy.

Return Values
       This function returns one of these status return constants:

       DRMSuccess	 The   function   executed
			 successfully.
       DRMNotFound	 File not found.
       DRMFailure	 The function failed.

See Also
       DwtCloseHierarchy(3Dwt)

															    DwtOpenHierarchy(3Dwt)
All times are GMT -4. The time now is 06:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy