My awk executable is not printing FILENAME...: why?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting My awk executable is not printing FILENAME...: why?
# 1  
Old 06-13-2018
My awk executable is not printing FILENAME...: why?

Hello, there!

I am running an executable awk script with 'source.awk input_file' and found that when I need to print FILENAME, or ENVIRON["AWKPATH"] or even FNR nothing happens [except for an empty line]...
However, if I run it with 'awk -f source.awk input_file', then those variables are printed...
What is the reason for that behaviour?
Thanking you in advance.
# 2  
Old 06-13-2018
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

My awk executable is not printing FILENAME...: why?

Hello, there! I am running an executable awk script with 'source.awk input_file' and found that when I need to print FILENAME, or ENVIRON or even FNR nothing happens ... However, if I run it with 'awk -f source.awk input_file', then those variables are printed... What is the reason for that... (6 Replies)
Discussion started by: fbird3
6 Replies

2. Shell Programming and Scripting

Issue when printing filename through cygwin using a variable with awk

Hi, If i were to do this an print out the file, it will show as it is in the command $ awk '/Privilege Use/ {P=0} /Object Access/ {P=1} P' AdvancedAudit.txt Object Access File System No Auditing Registry No Auditing Kernel... (1 Reply)
Discussion started by: alvinoo
1 Replies

3. UNIX for Dummies Questions & Answers

Command - filename as arguments - make executable to all users.

Edit: Sorry. Mistakenly posted - please delete (3 Replies)
Discussion started by: Reddax
3 Replies

4. Shell Programming and Scripting

Make multiple awk files into an executable

Hello everyone, The following are my input files. The following are my sequence of steps. Can someone please let me know about how to make these bunch of steps into a single script so that I start the script with 1.txt and 2.txt, after execution gives me the final... (11 Replies)
Discussion started by: jacobs.smith
11 Replies

5. UNIX for Advanced & Expert Users

fgrep - printing pattern and filename

Hi, I have a patternfile with following pattern cat dog cow pig Let's say I have thousand files file0001 file0002 file0003 . . . file1000 Each pattern can occur multiple times in multiple files. How can I search for pattern so the output of pattern and the filename is printed... (1 Reply)
Discussion started by: yoda9691
1 Replies

6. Shell Programming and Scripting

Help with printing the calling script filename

Consider the following sample scripts..... filename: f1 # Call f3 f3 filename: f2 # Call f3 f3 filename: f3 # f3 echo "$x called me" (2 Replies)
Discussion started by: frozensmilz
2 Replies

7. Shell Programming and Scripting

problem in making Awk executable script

Guys I placed #!path/awk -f placed awk script and used $1 to call 1st inputfile inside the script. But some where I did mistake. Could you please help me run this script as executable I forgot to mention I also used BEGIN before placing awk script. But nothing worked out. Script ... (2 Replies)
Discussion started by: repinementer
2 Replies

8. UNIX for Dummies Questions & Answers

Pattern matching and Printing Filename

Hi, My requirement is to search for a paritcular string from a group of .gz files and to print the lines containing that string and the name of the files in which that string is present. Daily 500 odd .gz files will be generated in a directory(directory name will be in the form of... (4 Replies)
Discussion started by: krao
4 Replies

9. UNIX for Dummies Questions & Answers

Filename Manipulation in AWK

I have created a nawk program and passing a file as an input parameter. The filename will be /home/dir/ksh/test.out I need to extract the filename alone. Is there anyway to get this ? Input : /home/dir/ksh/test.out Output -1: test.out Output -2 : t Input :... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

10. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies
Login or Register to Ask a Question