Sponsored Content
Full Discussion: Inserting a line at the end
Top Forums Shell Programming and Scripting Inserting a line at the end Post 302338504 by pludi on Tuesday 28th of July 2009 05:38:06 AM
Old 07-28-2009
Rule 10: [...]Don't send a private message with a technical question. The forums are for the benefit of all, so all Q&A should take place in the forums.
Also, please learn how to enclose your code in appropriate tags. It's the '#' symbol above the posting box.

Quote:
Originally Posted by Shazin
Hi

I am using the below script to enter a line in the file:

Code:
#!/bin/ksh
# To delete the last line if it contains the pattern Redirect permanent / http://www.virgin-atlantic.com
echo "Enter the URL that should point to the particular microsite"
read url
# To delete the last line if it contains the pattern Redirect permanent / http://www.virgin-atlantic.com
grep "Redirect permanent / http://www.virgin-atlantic.com" redirects.virgin-atlantic.com.conf > output1
if [$? -eq 0] ; then
    rm -r output1
    sed '$d' redirects.virgin-atlantic.com.conf > temp
    #cp temp redirects.virgin-atlantic.com.conf
    echo $url >> temp
    echo "Redirect permanent / http://www.virgin-atlantic.com" >> temp
    echo "Redirects Setup"
else
    echo $url >> temp
    echo "Redirects Setup"
fi

and am getting the error below:

Enter the URL that should point to the particular microsite
Redirect permanent /kpmgxy Virgin Atlantic Airways - Popup
./script.sh[7]: [0: not found
Redirects Setup

Please can you advise.

Best Regards,
Shazin
If you'd have posted the whole part before, not just the part where you thought the error was, we could have told you that the testing expression for the if requires whitespace surrounding the brackets, eg
Code:
if [ $? -eq 0 ]; then

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inserting a new line

I have a file where each line starts with a "update" statement. I want to insert a new line, after each line, with the words "go" in the new line. Can someone help me out with this? (1 Reply)
Discussion started by: ssmallya
1 Replies

2. UNIX for Advanced & Expert Users

Inserting a line before the line which matches the patter

Hi Is there any command where we can insert a line "2|||" before every line starting with "3|" my input is as follows 1|ETG|12345 3|79.58|||GBP|| 1|ETG|12345 3|79.58|||GBP|| 1|ETG|12345 2|EN_GB||Electrogalvanize 0.5 m2 ( Renault ) 1|ETG|12345 3|88.51|||GBP|| desired output... (10 Replies)
Discussion started by: laxmi131
10 Replies

3. UNIX for Dummies Questions & Answers

Inserting control characters at the end of each line

How to add control characters at the end of each line in a file? Can anyone help me with this? Thanks, Shobana (2 Replies)
Discussion started by: Shobana_s
2 Replies

4. UNIX for Dummies Questions & Answers

Inserting a ' at the end of each line

Hi all, I can use the following command to insert a ' at the beginning of each line sed "s/^/'/g" test.txt > test1.txt However, I'm unable to use the following to insert a ' at the end of each line in this way sed "s/$/'/g" test.txt > test1.txt Any... (3 Replies)
Discussion started by: karthiknaidu
3 Replies

5. Shell Programming and Scripting

Inserting a line in a file after every alternate line

Friends , I have a large file and i need to insert a line after every line.I am actually unaware how to do it.Any help appreciated. My File control station *ATM* , qread $OSS.Jul13A.FI01 interval 1 intcount 1 control station *ATM* , qread $OSS.Jul13A.FI02 interval 1 intcount... (4 Replies)
Discussion started by: appu2176
4 Replies

6. Shell Programming and Scripting

Help with inserting a line

Hello, I am new to this forum. I have a question in Unix shell scripting. Here is my requirement I have 1000 files and I need to insert a header with one line at the top of each of the 1000 files. Please let me know if you have any solution for this Thanks in advance. Raj (4 Replies)
Discussion started by: trajashekar
4 Replies

7. Shell Programming and Scripting

Commenting a specific line and inserting a new line after commented line.

Hello All, I have following file contents cat file #line=aaaaaa #line=bbbbbb #line=cccccc #line=dddddd line=eeeeee #comment=11111 #comment=22222 #comment=33333 #comment=44444 comment=55555 Testing script Good Luck! I would like to comment line line=eeeeee and insert a new line... (19 Replies)
Discussion started by: manishdivs
19 Replies

8. Shell Programming and Scripting

Inserting semicolon at the end of a line

HI Am totally confused with sed and translate command command.. My problem is I have a file like # vi test.csv ABC_IMUY ERD0_FN VEG_NON_DES_IYT BUY4_FLOW POI_SHD_URDF_IYUT_REDS_CYC UYT_PMC4_WIND EX_FRE_FRD_L2_REF_FLICT JHY_SGT_DSE_L2 IYO_HYTR_FGT_L3_BGT_ICT... (5 Replies)
Discussion started by: Priya Amaresh
5 Replies

9. UNIX for Dummies Questions & Answers

Inserting new line

Hi all, I want ot print a header with new line in the end. I am using echo like echo "this is header" I want output like This is header $ I tried -e also but it's not working. echo - e Can anyone help please? (6 Replies)
Discussion started by: dsa
6 Replies

10. UNIX for Beginners Questions & Answers

Inserting a blank line at the end of a .txt file?

Hi there, I am having this problem: a) I am uploading a txt file from windows (notepad) with some Gaussian 09 command lines; b) Gaussian needs in certain command files, that those files have a blank line at the end of the file! c) I open the command file with vi and no blank line at the of... (2 Replies)
Discussion started by: luismga
2 Replies
URL(4)							   BSD Kernel Interfaces Manual 						    URL(4)

NAME
url -- Realtek RTL8150L USB Ethernet driver SYNOPSIS
url* at uhub? urlphy* at mii? DESCRIPTION
The url driver provides support for USB Ethernet adapters based on the Realtek RTL8150L USB-ether bridge chip. The url driver supports the following adapters: CompUSA USBKR100 GreenHouse GH-USB100B Melco Inc. LUA-KTX Sitecom LN013 For more information on configuring this device, see ifconfig(8). DIAGNOSTICS
url%d: watchdog timeout A packet was queued for transmission and a transmit command was issued, however the device failed to acknowledge the transmission before a timeout expired. url%d: no memory for rx list The driver failed to allocate an mbuf for the receiver ring. SEE ALSO
arp(4), mii(4), netintro(4), usb(4), ifconfig(8) HISTORY
The url device driver first appeared in NetBSD 1.6. AUTHORS
The url driver was written by Shingo WATANABE <nabe@nabechan.org>. BSD
September 18, 2006 BSD
All times are GMT -4. The time now is 09:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy