10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
I'm trying to write a small script to automatize row data treatment. However, I got some trouble with the awk command.
I want to use awk to extract a define paragraph from a text file. The first and final lines are defined externally in two variables called debut and fin.
I... (2 Replies)
Discussion started by: TeaTimeSF
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
input:
AAA|1
my script (the function is just an example):
gawk 'BEGIN{FS=OFS="|"}
function repeat(str, n, rep, i){
for(i=1; i<=n; i++)
rep=rep str
return rep
}
{
variable_1=repeat($1,$2)
variable_2=repeat($1,$2+1)
variable_3=repeat($1,$2+3)
... (5 Replies)
Discussion started by: beca123456
5 Replies
3. Shell Programming and Scripting
Hi
I am having a file like this
##############################
j=1
while ]
do
temp_5=MODULE$j
awk '
$1 ~ /'${!temp_5}'/ {
do something }1' file1 > file2
((j = j +1 ))
done ###################
Setting the variables like this (8 Replies)
Discussion started by: kshitij
8 Replies
4. Shell Programming and Scripting
Hi friends,
I'm having a bit of a problem using shell variable in an awk if statement.
Please note that i'm using -v option as listed in many forums but I still don't get it working. Here's my code. Kindly help as I've gone crazy trying to work this out :wall:
#!/bin/bash -xv
... (4 Replies)
Discussion started by: vishwas.s
4 Replies
5. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
couldn't print out stored variable in awk
2. Relevant commands, code, scripts, algorithms:
i have in a... (5 Replies)
Discussion started by: ymc1g11
5 Replies
6. Shell Programming and Scripting
HI,
This is the code I am using:
awk -v aaa="connect" 'BEGIN {IGNORECASE} /aaa/,/!/ {print NR}' bb
This does not throw any error but it does not work. Pls help
Thanks. (4 Replies)
Discussion started by: sudvishw
4 Replies
7. Shell Programming and Scripting
Hi
How are you people ..
I am facing another problem regarding awk below is my code
-bash-3.00$ export a=10
-bash-3.00$ echo $a
10
-bash-3.00$ echo "" | nawk -v var=$a ' { if(var=10) { print "abc" } else { print "def"} } '
abc
-bash-3.00$ echo "" | nawk -v var=$a ' { if(var==10)... (2 Replies)
Discussion started by: aishsimplesweet
2 Replies
8. Shell Programming and Scripting
I have a txt file from which i am assiging a value to a variable
using the code in script1
script1.sh
export f=$(sed -n "/Freq *=/ s/.*= *//p" ${R_path}/output.txt)
echo "$f" --------> this works
in script2 ( which executes the script1)
eval ./script1.sh
if && ; then
echo... (1 Reply)
Discussion started by: shashi792
1 Replies
9. Shell Programming and Scripting
Hello,
I'm trying to make a script which reads the PID of a process using awk. I've read the thread in this forum where it is explained.
However, the problem i'm having is when attributing that PID value to a variable.
I'm using AIX 5.3.
The command is the following:
:/home/user1>ps -ef |... (2 Replies)
Discussion started by: mambo
2 Replies
10. UNIX Desktop Questions & Answers
Hi,
i have some files in one directory(say some sample dir) whose names will be like the following.
some_file1.txt
some_file2.txt.
i need to get the last modified file size based on file name pattern like some_
here i am able to get the value of the last modified file size using the... (5 Replies)
Discussion started by: eswarreddya
5 Replies