10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have file called in in.txt contains with the below lines I want to display the lines between the value which I would be passing.
one
two
three
four
five
ten
six
seven
eight
Expected output if I have passed one and ten
two
three
four
five (8 Replies)
Discussion started by: mychbears
8 Replies
2. Shell Programming and Scripting
I wrote this script which works well when I manually input 55518622 and 1
but I need this script to be generic and loop over the following table
awk '$4>(55518622-500000) && $4<(55518622+500000)' chr1_GEN2bim | awk 'BEGIN {min=1000000000; max=0;}; {\
if($4<min && $4 != "") min = $4; if($4>max... (8 Replies)
Discussion started by: fat
8 Replies
3. UNIX for Dummies Questions & Answers
Hello All,
May i please why my shell variable is not getting passed into awk script.
#!/bin/bash -vx
i="1EB07C50"
/bin/awk -v ID="$i" '/ID/ {match($0,/ID/);print substr($0,RSTART,RLENGTH)}' /var/log/ScriptLogs/keys.13556.txt
Thank you. (1 Reply)
Discussion started by: Ariean
1 Replies
4. Shell Programming and Scripting
Hi,
I am trying to write a bash script in which I need to pass a external variable to the awk program. I tired using -v but it not accepting the value.
Here is my sample code.
#!/usr/bin/bash
######################################################################################
####... (5 Replies)
Discussion started by: jpkumar10
5 Replies
5. Shell Programming and Scripting
consider the script below
sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml
awk -F'' '{for(i=1;i<=NF;i++){
if($i=="Alert id") {
if(id!="")
if(dt!=""){
cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies
6. Shell Programming and Scripting
I am trying to turn this into an alias with no luck. I would then like to put the alias into my bashrc file. I know awk is very picky about quotes. I have tried every version of quotes, single quotes, double quotes, and backslashes that I can think of.
VAR=$(xrandr | awk '$2=="connected"{s=$1}... (3 Replies)
Discussion started by: cokedude
3 Replies
7. Shell Programming and Scripting
Hi,
I'm new with this stuff, but I hope you can help me.
This is what I'm trying to do:
for id in $var; do
awk '{if ($1 == $id) print $2}' merg_data.dat > neigh.tmp
done
I need that for every "id", awk search the first column of the file merg_data.dat which contains "id" and... (3 Replies)
Discussion started by: matteo86
3 Replies
8. UNIX for Dummies Questions & Answers
Hello,
I have a file with 4 columns.
An arbitrary example is shown below:
a Tp 10 xyz
b Tq 8 abc
c Tp 99 pqr
d Tp 44 rst
e Tr 98 efg
Based on the values in col 2 and col 3, I will execute another program.
I have been running this:... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies
9. Shell Programming and Scripting
I am a newbie to awk and c programming, however am not a unix newbie. However, I do need help with a kshell script I am writing. It is almost complete, the last step is killing me. Any help would be greatly appreciated. What I am trying to do is cat a text file that has usernames. Then, using... (2 Replies)
Discussion started by: synergy_texas
2 Replies
10. UNIX for Advanced & Expert Users
Hello all,
I'm trying to run a script of this format -
for i in $(cat <file>); do
grep $i <file1>|awk '{print $i, $1, $2}'
It's not working - does anyone know how this can be done?
Khoom (5 Replies)
Discussion started by: Khoomfire
5 Replies