How to display the filename in process in my awk script ?
Hello,
I need again your help for a problem : For my CGI in bash/html, I should display informations from many csv files like that : http://www.noelshack.com/2019-32-4-1565270011-test4.png The script that allow me to do that : Code:
echo "<table>" So, I decide to change my script. My new script is : Code:
awk -F',|;' '{ $0=$1","$5","$6","$7} /'$test'/ { if (!a[$0]++)
|
You might try sub() instead and apply it to the built-in variable FILENAME or else to a copy of that variable.
Code:
... sub(".*/", "", FILENAME); ... |
I am not seeing why you cannot integrate the 2 pieces you have mentioned?
1. The split will still perform the same action and if wanting to do it at the start of each file, simply use BEGINFILE section 2. You will need to reimplement the -v switch to use 'test' variable in script and reset header where appropriate (see above maybe?) It is also unusual that your field positions have changed between the 2 scripts (ie. RAM $5 but is now $2 .... are you now reading from different files?) It would seem you need to spend some time with the manual |
@ Ezzmazz - You have posted multiple threads relating to the same basic script/problem, including this one, and this and this.
Please keep such related questions in a single thread in future. Doing so helps others to follow progress and changes more easily, making better use of their time and allowing better replies. It also helps future visitors by keeping related questions and replies in a single place. To help keep the quality of questions and resulting answers useful for everyone, please review the Site FAQ, and in particular the Welcome page and the links it provides when posting questions in future. |
All times are GMT -5. The time now is 05:15 PM. |