Sponsored Content
Top Forums Shell Programming and Scripting Help requested for a script with sed Post 302290265 by fatimap on Sunday 22nd of February 2009 09:29:11 PM
Old 02-22-2009
Help requested for a script with sed

Hello Folks,
I would very much appreciate if I could get help/suggestions on a particular sed usage. I have to write a script to take version info from a version file, compute the image name, print error if the image does not exist.
The version file looks like below:

"
Code:
#
# version.cfg
#
version =   4.2.1.1.10  # 
"

The script seems to get the image name right but does not expand correctly in "ifeq ($(wildcard $(IMAGE_FILE)), )"

This is what I get:
"
IMAGE_FILE = ./images/release-4.2.1.1.10.tar.gz 
Makefile:19: *** No image file "./images"/release-`grep version ./version.cfg | grep "=" | cut -d'=' -f2 | sed -e 's/#.*//' -e 's/[ ^   ]*//' -e 's/\ .*//'`.tar.gz.  Stop.
"

This is my script:
==================
"
.PHONY: chkImage
VERSION_FILE := ./version.cfg
ifeq ($(wildcard $(VERSION_FILE)),)
    $(error $(nl-ht)No Version File $(VERSION_FILE) Exists) 
endif
ImageRoot := "./images"
Version := `grep version $(VERSION_FILE) | grep "=" | cut -d'=' -f2 |   \
                    sed -e 's/\#.*//' -e 's/[ ^ ]*//' -e 's/\ .*//'`
Image := release-$(Version).tar.gz
IMAGE_FILE := $(ImageRoot)/$(Image)

all: chkImage

chkImage:
        @printf "IMAGE_FILE = $(IMAGE_FILE) \n"
ifeq ($(wildcard $(IMAGE_FILE)), )
    $(error $(nl-ht)No image file $(IMAGE_FILE))
endif
"

Your help in resolving this issue would be greatly appreciated.

Last edited by Neo; 02-23-2009 at 12:41 PM.. Reason: Added code tags - please use them!
 

10 More Discussions You Might Find Interesting

1. Email Antispam Techniques and Email Filtering

help requested: procmail receipes

Hello all. I want some help procmail receipe. I tried to get some mails' sender and receiptient. Then tried to send them a bash script. But it didnot work. I try a lot of variation of the below receipe. Could anyone can help what is wrong on my receipe? Or if the recepie is correct what can be... (0 Replies)
Discussion started by: kedi
0 Replies

2. Solaris

Your Opinion requested

Ladies/Gentlemen, I am looking for a web-based tool to keep track of my Sun inventory. The following list of fields are fields I would like to store: Root Passwd (needs to be secure) / Hostid / Console Port / IP Address / Platform / Application / Hostname . . . you get the point. Do any of... (4 Replies)
Discussion started by: pc9456
4 Replies

3. AIX

AIX 4.1.5/RS6000 boot hang, help requested

Hello there! I have a RS-6000 7043-140 machine with AIX version 4.1.5, that is working for almost 8 years now. It has a tty monitor. My problem started when I upgraded my machine to install a gxt250 graphics adapter card together with a 15" AOC VGA Monitor, logitech keyboard and mouse, ... (2 Replies)
Discussion started by: bright_genius
2 Replies

4. Shell Programming and Scripting

AWK issue--> Help requested

Fairly new scripter so please bare with me if what I have done below is not according to standards. Okay...heres what I am trying to do. I have a pattern that I need to search for in a directory. This gives me a list of files that includes a control file that contains totals of the line nos for... (3 Replies)
Discussion started by: alfredo123
3 Replies

5. UNIX for Advanced & Expert Users

assistance requested (sed related)

I gotta write a command to change the accounts in /etc/passwd that use a shell other than the bash to bash shell. those accounts that dont use a shell shouldnt get modified. assuming all the shell programs end in sh and other programs dont. and the result should go into /etc/passwd.rev any hint? (4 Replies)
Discussion started by: metalwarrior
4 Replies

6. Shell Programming and Scripting

Newbie bash scripting help requested

Hi, I'm very new to bash scripting and Linux in general. I'm running Ubuntu Server 10.04 and trying to write a bash script to launch a program. In doing so, I've come across a couple of things that I obviously don't understand. Here is a short script that exemplifies those things: ... (9 Replies)
Discussion started by: Carson Dyle
9 Replies

7. Shell Programming and Scripting

Help on sed requested

Hi I have a problem to resolve, I think sed is the best option, and I am not successful yet. Have a UNIX file which has records as of the 2 character state codes like NY NJ PA DE From the file I need to create this as a variable in the same script or another file -... (7 Replies)
Discussion started by: snair2010
7 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Sign in issues -- additional info as requested

User name: Michael Mullig <removed email addresses> (1 Reply)
Discussion started by: Mike Mullig
1 Replies

9. Shell Programming and Scripting

SQL Script HELP Requested.

Hello ALL , i am requesting help on for this script i am preparing to get the result of a query in a excel sheet : current Error: Script : NO Excel file created. requesting to know where i am going wrong. #!/bin/ksh... (2 Replies)
Discussion started by: anirudhkashikar
2 Replies

10. IP Networking

The requested URL was rejected. Please consult with your administrator

Ggod evening. I need your help please, in a Production system there is a process that download a xls file from an URL which is IMF(International Monetary Fund) and afterwards to be loaded into a databse table. When testing conectivity from a unix server to IMF seems to work but when editing it... (9 Replies)
Discussion started by: alexcol
9 Replies
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 01:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy