awk - using variables in pattern which contain full pathname
Hello.
I would like to make this bash command working.
In the following code, the bash variable 'ZYPPER_LOCAL_REP' contain a full pathname like '/path/to/path/somewhere'
I run into problems because of the use of a bash variables and because the variable contain a string with some '/'
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT DEBIAN
uncrustify
UNCRUSTIFY(1) User Commands UNCRUSTIFY(1)NAME
uncrustify - C, C++, C#, D, Java and Pawn source code beautifier
SYNOPSIS
uncrustify [OPTIONS] [FILES]
DESCRIPTION
If no input files are specified, the input is read from stdin.
If reading from stdin, you should specify the language using -l.
If -F is used or files are specified on the command line, the output filename is PFX + "/" + filename + SFX.
Unless, of course, the options --replace or --no-backup are used.
When reading from stdin or doing a single file via the '-f' option, the output is dumped to stdout, unless redirected with -o FILE.
Errors are always dumped to stderr
OPTIONS
Basic Options:
-c CFG Use the config file CFG.
If not specified, uncrustify will use $UNCRUSTIFY_CONFIG or $HOME.uncrustify.cfg.
-f FILE
Process the single file FILE, sending output to stdout or the file specified with -o.
-o FILE
Redirect output to FILE.
Use with -f, --update-config, --update-config-with-doc, --universalindent.
-F FILE
Read files to process from FILE, one filename per line.
You can create this file using something like 'find . -name "*.c" > list.txt'.
This cannot be combined with -f.
--prefix PFX
Prepend PFX to the output filename path.
This cannot be combined with -f, --replace, or --no-backup.
--suffix SFX
Append SFX to the output filename.
The default is '.uncrustify' if neither SFX or PFX are specified.
This cannot be combined with -f, --replace, or --no-backup.
--frag Assume the input is a code fragment and the first line is properly indented.
--replace
Replace source files (creates a backup).
This cannot be combined with -f, --prefix, or --suffix.
--no-backup
Replace files, no backup. Useful if files are under source control
This cannot be combined with -f, --prefix, or --suffix.
--mtime
Preserve mtime on replaced files.
-l Language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+
-t Load a file with types (usually not needed)
-q Quiet mode - no output on stderr (-L will override)
Config/Help Options:
-h -? --help --usage
Print this message and exit
--version
Print the version and exit
--show-config
Print out option documentation and exit
--update-config
Output a new config file.
--update-config-with-doc
Output a new config file with embedded usage comments.
--universalindent
Output a config file for Universal Indent GUI.
--detect
Detects the config from a source file. Use with '-f FILE'. Detection is currently fairly limited.
Debug Options:
-p FILE
Dump debug info to a file
-L SEV Set the log severity (see log_levels.h)
-s Show the log severity in the logs
--decode FLAG
Print FLAG as text and exit
EXAMPLES
Read a D file from stdin, output to stdout.
cat foo.d | uncrustify -q -c my.cfg -l d
Process a file, output to stdout.
uncrustify -c my.cfg -d foo.d
Process a source tree, output to a different tree.
find src -name "*.[ch]" > files.txt
uncrustify -c my.cfg -F files.txt --prefix out
Process a source tree in-place.
uncrustify -c my.cfg --no-backup $(find src -name "*.[ch]")
NOTES
Use comments containing ' *INDENT-OFF*' and ' *INDENT-ON*' to disable processing of parts of the source file.
AUTHOR
Written by Ben Gardner
REPORTING BUGS
Use the issue tracker at <http://sourceforge.net/projects/uncrustify>
COPYRIGHT
Copyright (C) 2006-2009 Ben Gardner
LICENSE
GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
uncrustify 0.59 Oct 2009 UNCRUSTIFY(1)