Basic awk question...getting awk to act on $1 of the command itself
I have a script problem that I am not able to solve due my very limited understanding of unix/awk.
This is the contents of test.sh
From the prompt if I enter: ./test.sh Hello World
I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello World" will I see "Hello" echoed. (and then I am not able to get back to the prompt without sending a break)
I have some scripts that use a Nokia program where I can enter: ./nokia.sh 41
and it will execute a task on a network element 41. I am attempting to use awk to format the input to one of these nokia programs, but I am not able to get awk to act on $1 of the command itself. I don't want to have to create a file where the sole content is "41" in order to get awk to format it.
All of my literature and searching only shows examples where the awk script refers to another file.
Hello!
I have written this script:
for file in "$( find $dirName -type d )"
do
echo "$file"
echo "hello"
done
but as a result I get all the directories and in the end the work "hello". Shouldn't it print the word "hello" after printing the name of each directory and not in the end?
... (1 Reply)
Hi,
I have a months worth of data that I need to separate into weekly files. There is a date column with dates in the following format: YYYYMMDD.
I'm thinking I can create the weekly files by using a grep command combined with an IF command and specify each day of the specific week I'm... (1 Reply)
Hello,
I have a log file , i want to delete the lines of the log file which is match with 1st and 5th field with different patterns. Once it will meet with that condition it will delete that line from the log . I dont want to create any temp file over there.
Successfully able to retrieve the... (1 Reply)
edit: SOLVED - see below for solution
Hi there,
I've inherited a gob of Linux hosts and so am learning linux from the bottom of the deep end of the pool (gotta say I'm warming up to Linux though - it's not half bad)
Right now iptables is confusing me and I could use some pointers as to how... (0 Replies)
Hi,
I am studying an awk command:
awk '{ sub(/\/\/.*/, "", $NF); print }' input.txt
The input.txt is:
char*s1="//hello"; //comment
//delete
/* hello //*/
The output is :
char*s1="//hello";
/* hello (2 Replies)
Hi,
Sorry if this is a newbie question. I guess you can use either awk or shell script for this sequence of operations, but knowing very little about either of them I'm not sure how I should try to write this.
The basic objective is to copy certain files that are scattered all over my... (10 Replies)
:D:D:D
These are list of command i typed on opensuse terminal and evolve lots of doubt around ,that i can't answer.
COMMAND 1 linux-xavv:/ # cd
COMMAND 2 linux-xavv:~ #
Does above command 1 and command two with red labelled sign make different meaning or same .
1
linux-xavv:/... (1 Reply)