01-09-2013
I'm not 100% positive. It may be the way backticks `` allow splitting, if your shell supports $( ) syntax that may cause less problems.
This User Gave Thanks to Corona688 For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i would like to pass a variable to awk wherein the variable comes from external loop.
i tried this...
let x=0
until test $x -eq 32
do
cat file | awk '{ print $1 , "Number" , $($x) }' >> output
done
thanks, (4 Replies)
Discussion started by: inquirer
4 Replies
2. Shell Programming and Scripting
I wanna use a system function to deal with several data. So I use awk variable FILENAME to transfer the file directory to system command, but it does not work.
I use a shell function "out_function" to deal with data and save the result in another directory with the same file name.
How can I... (2 Replies)
Discussion started by: zhynxn
2 Replies
3. Shell Programming and Scripting
I am trying to pass 2 shell variable's ("START" and "END") define earlier in the script to this awk statement, but i can't seem to pass it on. PLs help.
set START = xxxx
set END = yyyy
set selected_file = `awk '/$START/,/$END/' filename` (24 Replies)
Discussion started by: Raynon
24 Replies
4. UNIX for Dummies Questions & Answers
I have an awk statement where I Need to pass an environment variable but I cannot get it to work:
My evironment varible examples below:
$FILE1=/dev/fs/file.new
$FILE2=/dev/fs/file.old
Code below:
awk -F"|" '
BEGIN {
while( getline < "$FILE1" )
{ arr=1 }
}
arr != 1 { print }
'... (12 Replies)
Discussion started by: eja
12 Replies
5. Shell Programming and Scripting
HI all,
some more mistery about AWK, I hope you can help me out:
1)
I have a normal ksh script and sometime I call awk command. I set some variables in the script and I would like to use them up within AWK as well. Unfortunately AWK seems to forget all the variable values outside of its own... (1 Reply)
Discussion started by: BearCheese
1 Replies
6. Shell Programming and Scripting
Hi
I want to pass variables with the NR function in awk command.
test_file1 is input file having 500 records.
var1=100.
var2=200
awk -F" " 'NR >= $var1 && NR <= $var2' test_file1 > test_file2.
My end result should be that test_file2 should have records from line number between... (2 Replies)
Discussion started by: Nishithinfy
2 Replies
7. Shell Programming and Scripting
Hello folks,
I've a (perhaps) simple question.
In a text file I've :
server_name1: directory1
server_name2: directory2
server_name3: directory3
I want to make a loop that lets me connect and operate on every server:
rsh server_name1 "ls -l directory1"
I've tried with awk,... (6 Replies)
Discussion started by: gogol_bordello
6 Replies
8. Shell Programming and Scripting
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist.
diff=$1$2.diff
id=$2 new=new_$diff
echo "My id is $1"
echo "I want to sync for user account $id"
##awk command I am using is as below
cat $diff | awk... (2 Replies)
Discussion started by: Ashunayak
2 Replies
9. UNIX for Advanced & Expert Users
I must have forgot how to do this, but, I am attempting to enter a variable into an awk / gawk search pattern.
I am getting a value from user input to place in a specific section of a 132 character string.
my default command is ....
gawk --re-interval '/^(.{3}P .{4}CYA.{8}1)/' ... (3 Replies)
Discussion started by: sdeevers
3 Replies
10. UNIX for Beginners Questions & Answers
Hello All,
Hope you're doing well !
I am trying below command to be passed in a shell script, header_date_14 is a variable and $1 is the name of a file I intend to pass as a command line argument, however command line argument is not being accepted.
header_date_14=$(m_dump... (8 Replies)
Discussion started by: ektubbe
8 Replies
DCMD(1) General Commands Manual DCMD(1)
NAME
dcmd - expand file lists of .dsc/.changes files in the command line
SYNOPSIS
dcmd [options] [command] [changes-file|dsc-file] [...]
DESCRIPTION
dcmd replaces any reference to a .dsc or .changes file in the command line with the list of files in its 'Files' section, plus the file
itself. It allows easy manipulation of all the files involved in an upload (for changes files) or a source package (for dsc files).
If command is omitted (that is the first argument is an existing .dsc or .changes file), the expanded list of files is printed to stdout,
one file by line. Useful for usage in backticks.
OPTIONS
There are a number of options which may be used in order to select only a subset of the files listed in the .dsc or .changes file. If a
requested file is not found, an error message will be printed.
--dsc Select the .dsc file.
--schanges Select .changes files for the 'source' architecture.
--bchanges Select .changes files for binary architectures.
--changes Select .changes files. Implies --schanges and --bchanges.
--archdeb Select architecture-dependent binary packages (.deb files).
--indepdeb Select architecture-independent binary packages (.deb files).
--deb Select binary packages (.deb files). Implies --archdeb and --indepdeb.
--archudeb Select architecture-dependent udeb binary packages.
--indepudeb Select architecture-independent udeb binary packages.
--udeb Select udeb binary packages. Implies --archudeb and --indepudeb.
--tar, --orig Select the tar file.
--diff Select the Debian diff file.
Each option may be prefixed by --no to indicate that all files not matching the specification should be selected.
It is not possible to combine positive filtering options (e.g. --dsc) and negative filtering options (e.g. --no-changes) in the same dcmd
invocation.
--no-fail-on-missing, -r
If any of the requested files were not found, do not output an error.
EXAMPLES
Copy the result of a build to another machine:
$ dcmd scp rcs_5.7-23_amd64.changes elegiac:/tmp
rcs_5.7-23.dsc 100% 490 0.5KB/s 00:00
rcs_5.7-23.diff.gz 100% 12KB 11.7KB/s 00:00
rcs_5.7-23_amd64.deb 100% 363KB 362.7KB/s 00:00
rcs_5.7-23_amd64.changes 100% 1095 1.1KB/s 00:00
$
$ dcmd --diff --deb scp rcs_5.7-23_amd64.changes elegiac:/tmp
rcs_5.7-23.diff.gz 100% 12KB 11.7KB/s 00:00
rcs_5.7-23_amd64.deb 100% 363KB 362.7KB/s 00:00
$
Check the contents of a source package:
$ dcmd md5sum rcs_5.7-23.dsc
8fd09ea9654cda128f8d5c337d3b8de7 rcs_5.7.orig.tar.gz
f0ceeae96603e823eacba6721a30b5c7 rcs_5.7-23.diff.gz
5241db1e231b1f43ae5514b63d2523f8 rcs_5.7-23.dsc
$
$ dcmd --no-diff md5sum rcs_5.7-23.dsc
8fd09ea9654cda128f8d5c337d3b8de7 rcs_5.7.orig.tar.gz
5241db1e231b1f43ae5514b63d2523f8 rcs_5.7-23.dsc
$
SEE ALSO
dpkg-source(1), dpkg-genchanges(1).
AUTHOR
This program was written by Romain Francoise <rfrancoise@debian.org> and is released under the GPL, version 2 or later.
DEBIAN
Debian Utilities DCMD(1)