Sponsored Content
Top Forums Shell Programming and Scripting awk - using variables in pattern which contain full pathname Post 303038695 by jcdole on Wednesday 11th of September 2019 12:39:25 PM
Old 09-11-2019
Thank you everybody fore helping.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting pathname variables with ksh

With C Shell you can get the root, head, tail and extension of a pathname by using pathname variable modifiers. Example Script: #! /bin/csh set pathvar=/home/WSJ091305.txt echo $pathvar:r echo $pathvar:h echo $pathvar:t echo $pathvar:e The result of executing this script is: ... (7 Replies)
Discussion started by: BCarlson
7 Replies

2. HP-UX

pgrep doesn't perform full command line pattern matching

Hi! I need to get PID of some particular process and I wonder if I can use pgrep tool for this purpose. The problem is that pgrep doesn't perform pattern matching on the whole command line, even if I use -f key. Parsing output of ps command is not quite convenient... Also deamon, which PID I need... (2 Replies)
Discussion started by: Sapfeer
2 Replies

3. Shell Programming and Scripting

How to pass shell variables to awk's pattern?

How would I get folders owned by specific users.. I want to pass users as a shell variable to awk. drwxr-x--x 3 user1 allusers 512 Oct 14 2006 946157019/ drwxr-x--x 3 user2 allusers 512 Mar 9 2008 94825883/ drwxr-x--x 3 user3 allusers 512 Mar 9 2008 948390501/ ... (3 Replies)
Discussion started by: kchinnam
3 Replies

4. Shell Programming and Scripting

Text pattern with AWK and variables

How to to pass variable to the below awk command I would like to pass variables to the awk command instead of the constants "a/cc" but I don't know exactly the correct syntax awk '/a/,/cc/' temp1.out file.txt a b s cc g d output a b s (8 Replies)
Discussion started by: ahmedamro
8 Replies

5. Shell Programming and Scripting

print pattern between two variables awk sed

I am trying to print text between two variables in a file I have tried the following things but none seem to work: awk ' /'$a'/ {flag=1;next} /'$b'/{flag=0} flag { print }' file and also sed "/$a/,/$b/p" file But none seem to work Any Ideas? Thanks in Advance (5 Replies)
Discussion started by: forumbaba
5 Replies

6. UNIX for Advanced & Expert Users

use of variables in awk to search for pattern from a file

Hi, I need to extract all the content between two strings stored in two variables "startstring" and "endstring" startstring=hello enstring=world #notworking awk '/$startstring/, $NF ~ /$endstring/ ' file > file2 The above code is not working with variables. It works when actual string... (2 Replies)
Discussion started by: jeanjkj
2 Replies

7. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

8. Shell Programming and Scripting

Include pathname in awk output?

I am running an awk to verify all the memory settings for tomcat, and need to include path or directory in output .... I am running: awk '{ print $3 }' /opt/dir1/dir2/*/tomcat/bin/setenv.sh Output results: -Xms1024m -Xmx1536m -Xmx1536m -Xmx1024m -Xms1024m -Xms1024m -Xms512m -Xms1024m... (3 Replies)
Discussion started by: kgolli
3 Replies

9. Shell Programming and Scripting

Find and replace the path value in files, pattern is not full known.

Hi, I need to do find and replace, but the pattern is not full known. for example, my file has /proj/app-d1/sun or /data/site-d1/conf here app-d1 and site-d1 is not constant. It may be different in different files. common part is /proj/xx/sun and /data/xxx/conf i want to find where ever... (6 Replies)
Discussion started by: rbalaj16
6 Replies

10. Shell Programming and Scripting

Comment all lines which are not already commented for each full path pattern matched

Hello. Question 1 : I want to comment out all lines of a cron file which are not already commented out for each full path pattern matched. Example 1 nothing to do because line is already commented out; pattern = '/usr/bin/munin-cron' # */5 * * * * munin test -x... (3 Replies)
Discussion started by: jcdole
3 Replies
CURSES_COLOR(3) 					   BSD Library Functions Manual 					   CURSES_COLOR(3)

NAME
curses_color, has_colors, can_change_color, start_color, init_pair, pair_content, COLOR_PAIR, PAIR_NUMBER, init_color, color_content, no_color_attributes -- curses color manipulation routines LIBRARY
Curses Library (libcurses, -lcurses) SYNOPSIS
#include <curses.h> bool has_colors(void); bool can_change_color(void); int start_color(void); int init_pair(short pair, short fore, short back); int pair_content(short pair, short *fore, short *back); int COLOR_PAIR(int n); int PAIR_NUMBER(int val); int init_color(short color, short red, short green, short blue); int color_content(short color, short *red, short *green, short *blue); attr_t no_color_attributes(void); extern int COLOR_PAIRS; extern int COLORS; DESCRIPTION
These functions manipulate color on terminals that support color attributes. The function has_colors() indicates whether a terminal is capable of displaying color attributes. It returns TRUE if the terminal is capable of displaying color attributes and FALSE otherwise. The function can_change_color() indicates whether a terminal is capable of redefining colors. It returns TRUE if colors can be redefined and FALSE if they can not. The function start_color() initializes the curses color support on a terminal. It must be called before any color manipulation functions are called on that terminal. The function initializes the eight basic colors (black, red, green, yellow, blue, magenta, cyan and white) that are specified using the color macros (such as COLOR_BLACK) defined in <curses.h>. start_color() also initializes the global external variables COLORS and COLOR_PAIRS. COLORS defines the number of colors that the terminal supports and COLOR_PAIRS defines the number of color-pairs that the terminal supports. These color-pairs are initialized to white foreground on black background. start_color() sets the colors on the terminal to the curses defaults of white foreground on black background unless the functions assume_default_colors() or use_default_colors() have been called previously. The function init_pair(pair, fore, back) sets foreground color fore and background color back for color-pair number pair. The valid range for the color-pair pair is from 1 to COLOR_PAIRS - 1 and the valid range for the colors is any number less than COLORS. Specifying a nega- tive number will set that color to the default foreground or background color. The 8 initial colors are defined as: COLOR_BLACK COLOR_RED COLOR_GREEN COLOR_YELLOW COLOR_BLUE COLOR_MAGENTA COLOR_CYAN COLOR_WHITE Color-pair 0 is used as the default color pair, so changing this will have no effect. Use the function assume_default_colors() to change the default colors. The function pair_content(pair, *fore, *back) stores the foreground and background color numbers of color-pair pair in the variables fore and back, respectively. The macro COLOR_PAIR(n) gives the attribute value of color-pair number n. This is the value that is used to set the attribute of a character to this color-pair. For example, attrset(COLOR_PAIR(2)) will display characters using color-pair 2. The macro PAIR_NUMBER(val) gives the color-pair number associated with the attribute value val. The function init_color(color, red, green, blue) sets the red, green and blue intensity components of color color to the values red, green and blue, respectively. The minimum intensity value is 0 and the maximum intensity value is 1000. The function color_content(color, *red, *green, *blue) stores the red, green and blue intensity components of color color in the variables red, green, and blue, respectively. The function no_color_attributes() returns those attributes that a terminal is unable to combine with color. RETURN VALUES
The functions start_color(), init_pair(), pair_content(), init_color() and color_content() return OK on success and ERR on failure. SEE ALSO
curses_attributes(3), curses_background(3), curses_default_colors(3) STANDARDS
The NetBSD Curses library complies with the X/Open Curses specification, part of the Single Unix Specification. The function no_color_attributes() and the use of negative color numbers are extensions to the X/Open Curses specification. HISTORY
These functions first appeared in NetBSD 1.5. BSD
July 20, 2009 BSD
All times are GMT -4. The time now is 02:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy