10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm writing a bash script, and I am having trouble with this line:
awk '{print "url = \"http://www.example.com/directory/$type/"$1"\""}' input.file > output.file
Within the URL being printed, I wish the value of the variable "$type" to be printed, after being read from user input from the... (2 Replies)
Discussion started by: meridionaljet
2 Replies
2. Shell Programming and Scripting
I have an Shell script which has few global variables
eg :
range=100;
echo "$range"
I want to use the same variable in my C++ program for example
int main()
{ cout << range << "\n"; }
i tried using this
int main(int argc, char *argv)
{ cout << range << "\n"; }
but... (5 Replies)
Discussion started by: shashi792
5 Replies
3. Shell Programming and Scripting
I have a fixed width text file data.txt delimited by pipe. My requirement is to replace the second column values by *. Problem is that when tried access the shell variable in the awk program, value of shell variable is not printed instead only the name of the variable is printed. Please help to... (4 Replies)
Discussion started by: VijayakumarS
4 Replies
4. Shell Programming and Scripting
I am trying to pass a shell array I created to match on values amongst other things.
I have a sample:
#! /bin/ksh
i=0
for id in `cat id.lst`
do
IDs=$id
(( i=i+1 ))
done
cat sqloutput.txt | awk -F, -v ids=$ID '{
# Do stuff
}'
But it looks as if I cannot do this.... (1 Reply)
Discussion started by: Zombywoof
1 Replies
5. Shell Programming and Scripting
program name--test
#!/bin/bash
output1=`/home/user/a.c`
output2=`/home/user/a.c`
k=`$output1 + 1`
m=`$output2 + 1`
echo $k
echo $m
---------------------------------------------------------------------------
prgram name--a.c
#include<stdio.h>
int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies
6. Shell Programming and Scripting
Hi,
i want awk to read a file and place it's content into two arrays. When trying to read these arrays with a "for a in ${source_path} "-Loop it gives the right result. But when trying to access directly (/bin/echo ${source_path}) it doesn't work.
I read "all "the awk threads in this forum and... (6 Replies)
Discussion started by: bateman23
6 Replies
7. Shell Programming and Scripting
As per title and much apprecieated! (2 Replies)
Discussion started by: biglau
2 Replies
8. Shell Programming and Scripting
Hello,
I wonder if it is possible to pass and use variables from shell environment into sed or awk. I am trying to achieve something similar to the following using sed or awk:
var=some_regular_expression
grep "$var" filename # Will extract lines from filename
The following code,... (3 Replies)
Discussion started by: nasersh
3 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a shell script in which there is a file
conn_$temp
where $temp has the pid of the shell script.
in this shell script i have an embedded awk script that must read the file
while ((getline < "conn_$temp") > 0)
However due to the "$temp" in the file name, the awk script is... (6 Replies)
Discussion started by: HIMANI
6 Replies
10. Shell Programming and Scripting
Hi,
I made a small awk program just to test array variables.
I couldn't find anything wrong with it.
But it doesn't give out valid numbers.( just 0.00 )
Do you see any problem that I didn't see?
Thanks in advance!
Here is the program:
##################################
BEGIN {
FS =... (4 Replies)
Discussion started by: whatisthis
4 Replies