How to use read the char * from file? | Unix Linux Forums | Emergency UNIX and Linux Support

  Go Back    


Emergency UNIX and Linux Support Please post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply.

How to use read the char * from file?

Emergency UNIX and Linux Support


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-28-2013
zigizag zigizag is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 April 2013, 3:39 AM EDT
Posts: 28
Thanks: 18
Thanked 0 Times in 0 Posts
How to use read the char * from file?

i have a file 1.txt. the file contains:
* server1.com : ewf,wefwef,wef,wef
-------------------------------------
* server2.com : ewf,wefwef,wef,wef
-------------------------------------
* server3.com : ewf,wefwef,wef,wef
-------------------------------------

how can i read * ? from the start of the line?

the is the code
Code:
#!/bin/bash

while read line
do
[[ "$line" =~ ^*server1.com ]] && url=${line##*: }

done < 1.txt

for U in ${url//,/ }
do
printf "http://$U.com\n"
done

it doesnt work...........
Sponsored Links
    #2  
Old 02-28-2013
RudiC RudiC is online now Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 23 July 2014, 3:44 PM EDT
Location: Aachen, Germany
Posts: 3,869
Thanks: 62
Thanked 918 Times in 871 Posts
Double posting not allowed.
Sponsored Links
    #3  
Old 02-28-2013
zigizag zigizag is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 April 2013, 3:39 AM EDT
Posts: 28
Thanks: 18
Thanked 0 Times in 0 Posts
what should i do? remove?

Quote:
Originally Posted by RudiC View Post
Double posting not allowed.
---------- Post updated at 08:55 AM ---------- Previous update was at 04:48 AM ----------

someone please??
    #4  
Old 02-28-2013
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 23 July 2014, 12:06 PM EDT
Location: Galactic Empire
Posts: 3,354
Thanks: 230
Thanked 1,190 Times in 1,123 Posts
I have answered your other thread
The Following User Says Thank You to Yoda For This Useful Post:
zigizag (02-28-2013)
Sponsored Links
    #5  
Old 02-28-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 July 2014, 2:05 PM EDT
Location: Saskatchewan
Posts: 18,968
Thanks: 746
Thanked 3,135 Times in 2,947 Posts
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
The Following User Says Thank You to Corona688 For This Useful Post:
zigizag (02-28-2013)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
error: invalid conversion from ‘const char*’ to ‘char*’ GSO Programming 8 06-09-2011 12:39 PM
concat const char * with char * nicos Programming 4 02-18-2009 12:01 PM
Adding a single char to a char pointer. pallak7 Programming 5 12-06-2008 10:46 PM
How to replace any char with newline char. mightysam Shell Programming and Scripting 5 09-18-2008 08:15 PM
need shell script to get last 10 char from a file name and write in to a new file raj0390 Shell Programming and Scripting 2 07-28-2008 07:09 AM



All times are GMT -4. The time now is 03:58 PM.