Sponsored Content
Top Forums Shell Programming and Scripting Help: How to convert this bash+awk script in awk script only? Post 302599411 by alexscript on Friday 17th of February 2012 04:23:34 AM
Old 02-17-2012
Help: How to convert this bash+awk script in awk script only?

This is the final first release of the dynamic menu generator for pekwm (WM).
Code:
#!/bin/bash

function param_val {
    awk "/^${1}=/{gsub(/^${1}="'/,""); print; exit}' $2
}
 
echo "Dynamic {" 
for CF in `ls -c1 /usr/share/applications/*.desktop`
do
    name=$(param_val Name $CF)

    executable=$(param_val Exec $CF)

    icon=$(param_val Icon $CF)

    categories=$(param_val Categories $CF | awk -F ";" '{print $1}')

    echo " Entry = \"$name\" { Actions = \"Exec $executable\" }"

done
echo "}"

Someone could help to convert this script on awk only?
While maintain the same clearity as now with this hybrid combination of bash+awk?

Note:
I decide to split it for maintain the discussion more clear, with an initial problem and with a final end.
So now i ask only one question each time.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert a script in awk script

Hello guys, I have a script like: echo "Errores 0x01 `cat errores.log | grep 0x00000001 | wc -l` " > class_total echo "Errores 0x0B `cat errores.log | grep 0x0000000B | wc -l` " >> class_total echo "Errores 0x45 `cat errores.log | grep 0x00000045 | wc -l` " >> class_total echo "Errores... (14 Replies)
Discussion started by: Lestat
14 Replies

2. Shell Programming and Scripting

convert this into csv using awk/shell script

Hi Scripting gurus, I need to convert following text snippet into csv. please help Input heading1 = data1 heading2 = data2 .. .. heading n = data n heading 1 = data1 .. .. Output data1,data2,....,data n (3 Replies)
Discussion started by: azs0309
3 Replies

3. Shell Programming and Scripting

Awk script to convert csv to html

Hi Written some script to convert csv to html but could not add table headers.Below are the errors iam getting ./csv2html | more + awk -v border=1 -v width=10 -v bgcolor=black -v fgcolor=white BEGIN { printf("<table border=\"%d\" bordercolor=\"%s\" width=\"%d\"... (2 Replies)
Discussion started by: zeebala1981
2 Replies

4. Shell Programming and Scripting

Help: how to convert perl script to awk in windows2003 server environment

For the following perl script, can anyone help to convert it to awk statement in windows2003 server environment ? Code: foreach $k (sort {$a <=> $b} keys %psnum) (1 Reply)
Discussion started by: tojzz
1 Replies

5. Programming

awk script to convert a text file into csv format

hi...... thanks for allowing me to start a discussion i am collecting usb usage details of all users and convert it into csv files so that i can export it into some database.. the input text file is as follows:- USB History Dump by nabiy (c)2008 (1) --- Kingston DataTraveler 130 USB... (2 Replies)
Discussion started by: certteam
2 Replies

6. Shell Programming and Scripting

AWK manipulation in bash script

EDIT: This has been SOLVED. Thanks! Greetings everyone, I've posted a few threads with some quick help questions, and this is another one of those. I can't post enough gratitude for those much more knowledgeable than myself who are willing to give good advice for my minor issues. Now,... (2 Replies)
Discussion started by: Eblue562
2 Replies

7. Shell Programming and Scripting

Using AWK in a bash script

So I am a newbie obviously but I need some help. I am trying to run a script to check that the number of fields in a database is equal to 4, if not they should try again and run an appropriate database file. The fields are separated by a semi colon. I've tried a lot of things, this what I'm... (3 Replies)
Discussion started by: mb001
3 Replies

8. Shell Programming and Scripting

Help with convert awk script into perl

Input file (a list of input file name with *.txt extension): campus.com_icmp_ping_alive.txt data_local_cd_httpd.txt data_local_cd.txt new_local_cd_mysql.txt new_local_cd_nagios_content.txt Desired output file: data local_cd_httpd data local_cd new local_cd_mysql new ... (9 Replies)
Discussion started by: perl_beginner
9 Replies

9. Shell Programming and Scripting

AWK/Bash script

I would like to write a script to extend this command to a general case: BEGIN {s_0=0;n_0=0}{n_0++;s_0+=($51-$1)^2}END {print sqrt(s_0/n_0)} i.e. so that BEGIN {s_0=0;n_0=0}{n_0++;s_0+=($51-$1)^2}END {print sqrt(s_0/n_0)} BEGIN {s_1=0;n_1=0}{n_1++;s_1+=($51-$2)^2}END {print... (3 Replies)
Discussion started by: chrisjorg
3 Replies

10. Shell Programming and Scripting

Convert XML to CSV using awk or shell script

Hello, I am working on a part of code where I need a awk or shell script to convert the given XML file to CSV or TXT file. There are multiple xml files and of different structure, so a single script is required for converting data. I did find a lot of solutions in the forum but... (16 Replies)
Discussion started by: Rashmitha
16 Replies
ElixirFM::Exec(3pm)					User Contributed Perl Documentation				       ElixirFM::Exec(3pm)

NAME
ElixirFM::Exec - Interface to the ElixirFM executable REVISION
$Revision: 946 $ $Date: 2010-04-12 21:27:23 +0200 (Mon, 12 Apr 2010) $ SYNOPSIS
use ElixirFM::Exec; # 'elixir' will be tried out use ElixirFM::Exec '.'; # './elixir' will be invoked use ElixirFM::Exec './elixir'; # './elixir' will be invoked use ElixirFM::Exec 'some/other'; # 'some/other/elixir' unless # 'some/other' is executable ElixirFM::Exec::elixir 'help'; import ElixirFM::Exec 'other/elixir'; # switching to 'other/elixir' ElixirFM::Exec::elixir 'inflect', ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]"; ElixirFM::Exec::inflect ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]"; DESCRIPTION
The ElixirFM::Exec module provides a simple interface for invoking the ElixirFM executable, which you need to install on your system yourself. The download and further information are at http://sourceforge.net/projects/elixir-fm/ <http://sourceforge.net/projects/elixir-fm/>. AUTHOR
Otakar Smrz "<otakar smrz mff cuni cz>", <http://ufal.mff.cuni.cz/~smrz/> COPYRIGHT &; LICENSE Copyright (C) 2005-2010 Otakar Smrz This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3. perl v5.12.3 2011-06-13 ElixirFM::Exec(3pm)
All times are GMT -4. The time now is 02:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy