The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Combine a datafile with Master datafile, emergent! onthetopo Shell Programming and Scripting 6 05-12-2007 07:36 AM
Append current date to filename gigigi UNIX for Dummies Questions & Answers 3 07-20-2006 06:10 PM
Append date to filename hshapiro UNIX for Dummies Questions & Answers 5 04-03-2006 10:52 AM
oracle datafile *dbf tt155 SUN Solaris 3 12-17-2005 07:38 PM
replace one section in a datafile Paprika Shell Programming and Scripting 4 06-17-2005 09:48 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-12-2006
Satyagiri Satyagiri is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 4
Append filename to datafile

I am working on an shell script which checks for all the file starting with abc*.*
and if file found then the filelines need to append the file name in begining


can some one help with the filename appending...


for i in `ls $filename*.csv`
do
echo $i
--- NEED to append file name befor calling the loader
sqlldr
#mv $i $destdir/
done
exit 0
  #2 (permalink)  
Old 10-12-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Quote:
Originally Posted by Satyagiri
for i in `ls $filename*.csv`
do
echo $i
--- NEED to append file name befor calling the loader
sqlldr
#mv $i $destdir/
done
exit 0
something like
Code:
for i in `ls $filename*.csv`
do
echo $i
--- NEED to append file name befor calling the loader
sqlldr
#NOTE: almost pseudocode
mv $i tmpfile
echo "$i" > $i
cat tmpfile >> $i
rm tmpfile
#mv $i $destdir/
done
exit 0
  #3 (permalink)  
Old 10-12-2006
Satyagiri Satyagiri is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 4
Hitori,
it does not replace the file name to all the lines in the file
  #4 (permalink)  
Old 10-12-2006
Hitori's Avatar
Hitori Hitori is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2006
Posts: 360
Quote:
Originally Posted by Satyagiri
Hitori,
it does not replace the file name to all the lines in the file
You want to append filename to each line in the file? Pipe the output of your program:

Code:
script | sed "s/^/$i: /" >> $i
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0