m4 adds extra space at top of file.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting m4 adds extra space at top of file.
# 8  
Old 09-21-2010
Quote:
Originally Posted by Bubnoff
Thanks for the replies. I tried adding dnl both in the macro and in the file and I still end up with one blank line at the top.


Sample use of macros:

Code:
include(`bash_macros.m4')
START_SCRIPT(`fake_script',`Automation Dept.')
GLOBALS()
SANITY_CHECKS()
FUNCTIONS()
MAIN()
END_SCRIPT()

try
Code:
include(`bash_macros.m4')
START_SCRIPT(`fake_script',`Automation Dept.')dnl
GLOBALS()
SANITY_CHECKS()
FUNCTIONS()
MAIN()
END_SCRIPT()

This User Gave Thanks to john1212 For This Post:
# 9  
Old 09-21-2010
[UPDATE - SOLVED - See updates at bottom.]

Thanks John, however, I still get the blank line on line one.
Here's the output ( excerpt of top ) via:
Code:
cat -n test.sh | head

Output:
Code:
 
     1  
     2  #!/bin/bash
     3  #####################################
     4  # File: fake_script
     5  # Auth: Automation Dept. 
     6  # Desc:
     7  #
     8  # TODO:
     9  # BUGS:
    10  # RCS: $Id$

As an aside:
This is part of a larger make script to generate various projects with different options/parameters ...otherwise I could simply copy a template. I hope to use the macros as I'd be passing in various options ...more flexibility, etc..

Thanks again for all your input!

Bubnoff

---------- Post updated at 04:01 PM ---------- Previous update was at 03:53 PM ----------

Eureka!!

John, your solution worked with one adjustment:

You suggested:
Code:
include(`shell_script.m4')
START_SCRIPT(`fake_script',`Automation Dept. - CR')dnl
GLOBALS()
SANITY_CHECKS()
FUNCTIONS()
MAIN()
END_SCRIPT()

The solution was:
Code:
include(`shell_script.m4')dnl
START_SCRIPT(`fake_script',`Automation Dept. - CR')
GLOBALS()
SANITY_CHECKS()
FUNCTIONS()
MAIN()
END_SCRIPT()

You probably were suggesting this but overlooked my include statement. Anyway, thanks ...you rock!!

Bubnoff

Last edited by Bubnoff; 09-21-2010 at 08:05 PM.. Reason: SOLVED - thanks to john1212
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extra Space in output - remove

Hi All I am trying to perform the below operation -count=`cat abc.txt | wc -l` echo$count 5 Head=Start"$DATE"00000"$count"File echo $HEAD START15020300000 5File There is a space coming before 5 which is not needed . How to ignore that . (4 Replies)
Discussion started by: honey26
4 Replies

2. Shell Programming and Scripting

Space usage by top 5 users in a filesystem

I want to see top 5 users,who have occupied most amount of disk space in a filesystem. But not sure how to do it. I can get the usage for a particular user find . -user user -type f exec df -h {} \;|awk '{ s = s+$1 } END { print "Total used: ",s }' But how to get without specifying any user... (6 Replies)
Discussion started by: rka
6 Replies

3. UNIX for Dummies Questions & Answers

#Spool/Query executing with extra space.

Hello, I have a requirement where i have to spool some data to a file. i have achived the desired target but m facing one issue. i have attached the script and the output. i checked the data length in the table but it is only 45 for column 1. can you tell me how to remove these extra... (4 Replies)
Discussion started by: Mohammed_Tabish
4 Replies

4. Shell Programming and Scripting

[Solved] Howto remove extra space in the file

Hi Gurus, I have a file which contains some special char or space. when using cat -evt I can see the file as following: 0,"0000","abc/def aaa ... (6 Replies)
Discussion started by: ken6503
6 Replies

5. Shell Programming and Scripting

my shell now adds extra space at end of each line!

Hi, Since today, with csh or tcsh, if I do 'ls files* > list', every lines end with an extra space! What happenned? What can I do to go back when there was no extra space? If I change to bash, there's no extra space. Thanks, Patrick ---------- Post updated at 03:19 PM... (1 Reply)
Discussion started by: trogne
1 Replies

6. Solaris

Which gives the correct swap space top/vmstat ?

last pid: 29502; load avg: 21.8, 20.7, 20.4; up 8+08:49:09 763 processes: 589 sleeping, 9 running, 160 zombie, 5 on cpu CPU states: 0.0% idle, 28.2% user, 71.8% kernel, 0.0% iowait, 0.0% swap Memory: 32G phys mem, 2042M free mem, 8198M total swap, 8020M free swap kthr ... (2 Replies)
Discussion started by: chidori
2 Replies

7. Shell Programming and Scripting

extra space issue with awk

for diskname in $(lspv |awk '{print $1}') do lquerypv -h /dev/|awk '/'$diskname'/ { print ; exit }' done No output is returning from the loop. I think awk put an extra space to the command - lquerypv -h /dev/ so that the command is executed as i.e. lquerypv -h /dev/ hdisk230 with a space... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

8. Shell Programming and Scripting

Script to check top 5 biggest disk space users

Hi all, I am needing a bash shell script to generate a list of the top 5 users using the most disk space. I am thinking that the du command would be used somehow but I am at a loss. Can anyone help? Thanks! (3 Replies)
Discussion started by: sytemx
3 Replies

9. AIX

How to find the top 6 users (which consume most space)?

Hi everybody, I want to know if there is any posibility to find out - on an AIX system - which are the the users who consume most space or at least a posibility to obtain a list with all the users and how much space are they consuming ? Trying to use du command was useless. Any idea?... (5 Replies)
Discussion started by: RebelDac
5 Replies

10. UNIX for Dummies Questions & Answers

Swap space used greater than allocated using top

Hi there, When I run top on my machine it says I have 497M swap space in use, and 380M swap space free, but I have only allocated 512M swap space to the machine!!!! Does anyone know how swap used is calculated in the top command? Thanks... (1 Reply)
Discussion started by: chorgan
1 Replies
Login or Register to Ask a Question