10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them
abc.sh
----------
export Numbr_Parms=$#
export a=1
while
do
export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have been trying to retrieve the names of files present in a directory one by one but the names of files are getting overlapped on one another.
I tried the below command.
ls -1 > filename
please help me in getting the file names line by line without overlapping. I am using korn... (6 Replies)
Discussion started by: Pradhikshan
6 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I need to pass the multiple values of src1 to another variable. I managed to print it but not sure how to assign it to a variable in a loop.
src1=01,02,03
echo $src1|awk 'BEGIN {FS=","} {for(i=1;i<=NF;i++) print $i}'
I need to pass the value as
src2=01
src2=02
src2=03
Thanks... (4 Replies)
Discussion started by: shash
4 Replies
4. Shell Programming and Scripting
Hi Forum.
I have the following test.txt file and need to extract certain rows based on "starting position", "length of string" and "string to search for":
1a2b3d
2a3c4d
.....
My script accepts 3 parameters: (starting col pos, length to search for, string to search for) and would like to... (4 Replies)
Discussion started by: pchang
4 Replies
5. Shell Programming and Scripting
I have a file that has 2 fields called b_file:
11977 DAR.V3.20150209.1.CSV
3295 DAR.V3.20150209.1.CSV
1721 DAR.V2.20150210.1.CSV
I need to search a sftplog using the field 1, but want to maintain the relationship between field 1 and 2. I am passing field 1 as a parameter in a bash loop.
... (14 Replies)
Discussion started by: smenago
14 Replies
6. Shell Programming and Scripting
I wrote a very simple script to understand how to call user-defined functions from within awk after reading this post.
function my_func_local {
echo "In func $1"
}
export -f my_func_local
echo $1 | awk -F"/" '{for (k=1;k<=NF;k++) {
if ($k == "a" ) {
system("my_local_func $k")
}
else{... (19 Replies)
Discussion started by: sreyan32
19 Replies
7. Shell Programming and Scripting
Hi all,
Iam writing a perl script to create many files with variables in their name.
i am able to do it, if iam using only one variable. But with two variables the file
names are NOT getting generated in the way i want.
plz help me out.
1. open(SHW,">divw_unsigned_50_50_$k.reset") or die... (4 Replies)
Discussion started by: twistedpair
4 Replies
8. Shell Programming and Scripting
Currently have this:
set current=192.168.0.5
set servicehost = `echo $current | awk -F. '{print $4}'`
echo $numberoffields
5
..but would like to reduce # of variables and eliminate echo to have something like this:
set servicehost = `awk -v s="$current" -F. 'BEGIN{print $2}'`But... (3 Replies)
Discussion started by: Mid Ocean
3 Replies
9. UNIX for Advanced & Expert Users
hi,
which Unix/C function can i use to retrieve all group names with a particular group id?
The following C code prints out the group id number of a particular group name:
------------------------------------------------------------------------
#include <stdio.h>
#include <grp.h>
int... (3 Replies)
Discussion started by: Andrewkl
3 Replies
10. Shell Programming and Scripting
I need to get files names passed to a script. Here number of files passed may vary
like MyScript.ksh file1 file2 file3..... so on
I am writting script somthing like this
set -A Files
while (i<=$#)
do
File=$i
let i=i+1
done
Is this correct way doing this. Is there any other way.... (5 Replies)
Discussion started by: unishiva
5 Replies