Sponsored Content
Full Discussion: Parse Directory path - awk
Top Forums Shell Programming and Scripting Parse Directory path - awk Post 303039537 by RudiC on Wednesday 9th of October 2019 04:57:53 AM
Old 10-09-2019
Any attempt / idea / thought from your side?


I can't see your logics example comply to your specification - none of those $2 values represent the "same path upto 5 dir levels". The first entry has four levels only, the next two have five but are different. Please revise your spec / example.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse value from multiple row to create the path

Hi all, Hope all the expert can help me in this situation. Let say I have one file with multiple record like below: NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE FILE=TEST1 DIRECTORY=D:/DETAILS/1/0/test1.txt END NAME=FRAGMENT LANGUAGE=1 DIALECT=0 GENDER=NONE (13 Replies)
Discussion started by: shirleyeow
13 Replies

2. UNIX for Dummies Questions & Answers

awk to parse a directory name?

Hi, I have a directory file name: /auto/space/user/jen/CED/CED_01MZ/visit1/DCE_2eco/016/echo1 I would like to just get the following outputs into variables such that: variable1 = /auto/space/user/jen/CED/CED_01MZ/visit1/ and variable2 = DCE_2eco/016/echo1 I've tried it with... (2 Replies)
Discussion started by: nixjennings
2 Replies

3. Shell Programming and Scripting

Retrieve directory path from full file path through sh

Hi, I have a file abcd.txt which has contents in the form of full path file names i.e. $home> vi abcd.txt /a/b/c/r1.txt /q/w/e/r2.txt /z/x/c/r3.txt Now I want to retrieve only the directory path name for each row i.e /a/b/c/ /q/w/e/ How to get the same through shell script?... (7 Replies)
Discussion started by: royzlife
7 Replies

4. Shell Programming and Scripting

sed/awk for extracting directory from file path

Hi, I have following path: set file_path = D:/forums/prac/somedir/new1/file1.txt or set file_path = E:/new/forums1/prac/somedir/new2/file2.txt I need to grep "somedir" from file path. In this case preceding directory "prac" remains same for both the paths, but directories preceding... (7 Replies)
Discussion started by: sarbjit
7 Replies

5. Shell Programming and Scripting

Parse file name out of UNC path

Hello, I searched the forums and didn't see a situation like this: I cannot figure out how to parse out just the file name from the full path. The path looks like this: \\foo\bar\filename.ext I don't think something like 'cut' will work so I tried to whip up a regex but couldn't get it... (12 Replies)
Discussion started by: bytesnoop
12 Replies

6. Shell Programming and Scripting

Parse output path to set variable

I am looking to parse a text file output and set variables based on what is cropped from the parsing. Below is my script I am looking to add this feature too. All it does is scan a certain area of users directories for anyone using up more than X amount of disk space. It then writes to the... (4 Replies)
Discussion started by: es760
4 Replies

7. Shell Programming and Scripting

Variable of Path directory is not parsing in awk

Hi All, i had to split one files into 10 equally. For that i have coded below awk. OUTPUT_FILE=/home/sit/path/Files/file_EXPORT.lst DIR_NM=`dirname ${OUTPUT_FILE}` awk -v CURR_DATE="$(date +'%d-%m-%Y-%H-%M')" -v pth=$DIR_NM '{print >> pth/"tgt_file_name"CURR_DATE"_"NR%10 }' ${OUTPUT_FILE} ... (7 Replies)
Discussion started by: looney
7 Replies

8. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

9. UNIX for Beginners Questions & Answers

What is the difference ../directory path and ./directory path in ksh?

What is the difference ../directory path and ./directory path in ksh? (1 Reply)
Discussion started by: TestKing
1 Replies
XParseColor()															     XParseColor()

Name
  XParseColor - look up RGB values from ASCII color name or translate hexadecimal value.

Synopsis
  Status XParseColor(display, colormap, spec, exact_def_return)
	Display *display;
	Colormap colormap;
	char *spec;
	XColor *exact_def_return;

Arguments
  display   Specifies a connection to an X server; returned from XOpenDisplay().

  colormap  Specifies a colormap associated with the screen on which to look up the color.  This argument is required, but is meaningful only
	    with Xcms color specifications.

  spec	    Specifies the color string (see the "Description" section).  Uppercase or lowercase does not matter.  If the color name is not in
	    the Host Portable Character Encoding, the result is implementation-dependent.

  exact_def_return
	    Returns  the  RGB values corresponding to the specified color name or hexadecimal specification, and sets its DoRed, DoGreen, and
	    DoBlue flags.

Returns
  Zero on failure, non-zero on success.

Description
  XParseColor() looks up the string name of a color with respect to the screen associated with the specified colormap.	It returns the	exact
  color value.	It or hexadecimal values specified, or translating the hexadecimal code into separate RGB values.

  XParseColor() takes a string specification of a color, typically from a user-specified command line or resource value, and returns the cor-
  responding red, green, and blue values, suitable for a subsequent call to XAllocColor or XStoreColor().   spec  can  be  given  in  several
  forms, and may be looked up in different ways depending on the form.

  o  Color name, such as "blue".  This form is looked up in the server's RGB database, a sample of which is listed in Appendix D, The Server-
     side Color Database.

  o  Xcms color name, such as TekHVC:0.0/100.0/0.0.  This form is looked up in the client-side database for the screen	associated  with  the
     specified	colormap.   This  form is supported starting in Release 5.  For more information on this form of color specification, see the
     Programmer's Supplement for Release 5, or the Third Edition of Volume One.

  o  Hexadecimal specification such as #3a7.  This form consists of an initial sharp sign character followed by one of the following formats:

	#RGB   (one character per color)
	#RRGGBB   (two characters per color)
	#RRRGGGBBB   (three characters per color)
	#RRRRGGGGBBBB	(four characters per color)

     where R, G, and B represent single hexadecimal digits (uppercase or lowercase).  The hexadecimal strings must be NULL-terminated so that
     XParseColor()  knows  when it has reached the end.  When fewer than 16 bits each are specified, they represent the most significant bits
     of the value.  For example, #3a7 is the same as #3000a0007000.  The hexadecimal style is discouraged in Release 5 and later.

  Status is zero on failure, non-zero on success.  This routine will fail if the initial character is a sharp sign but the  string  otherwise
  fails  to  fit one of the above formats, or if the initial character is not a sharp sign and the named color does not exist in the server's
  database.

  For more information, see Volume One, Chapter 7, Color and in the Third Edition, the chapter on Device-Independent Color.

Structures
     typedef struct {
	 unsigned long pixel;
	 unsigned short red, green, blue;
	 char flags;	/* DoRed, DoGreen, DoBlue */
	 char pad;
     } XColor;

Errors
  BadColor  Invalid colormap.

See Also
  XBlackPixel(), XWhitePixel(), XAllocColor(), XcmsAllocColor(), XAllocColorCells(), XAllocColorPlanes(), XAllocNamedColor(), XcmsAllocNamed-
  Color(),  XFreeColors(), XLookupColor(), XQueryColor(), XQueryColors(), XStoreColor(), XcmsStoreColor(), XStoreColors(), XcmsStoreColors(),
  XStoreNamedColor().

Xlib - Color Cells														     XParseColor()
All times are GMT -4. The time now is 01:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy