Sponsored Content
Top Forums Shell Programming and Scripting Adding filename to each line of the file Post 302441630 by scripting_newbe on Sunday 1st of August 2010 11:38:04 PM
Old 08-02-2010
Thanks

Thanks a lot Jaduks:
I found the problem to my code as well:

Code:
SRC_DIR=$1  
DEST_DIR=$2

#Get the list of files in descending order 
C_C_FILE=  `ls $SRC_DIR/_IF927*.dat`

#Iterate through all the files in the src directory
for FILE in C_C_FILE
do
    BASEFILENAME=`basename $FILE`

    APPENDING="|"$BASEFILENAME    

#Append each line in the file and copy to the dest directory
    sed "s/$/"`echo $APPENDING`"/g" $SRC_DIR/$BASEFILENAME >  $DEST_DIR/$BASEFILENAME     

done

The reason why my code would not show on 1 single line is coz the length of the file name is too long and hence showing in 2 lines.

Anyways thanks a lot for your alternative solution which looks quite more elegant and short than mine Smilie

regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to adding the filename into file contents

Dear Experts, Please help to teach me how to add the filename into the file content so that i can get the output below:- Actually the file name ***************New output that I want*************** =====2005-11-12===== EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013... (2 Replies)
Discussion started by: missutoomuch
2 Replies

2. Shell Programming and Scripting

Adding filename into file content

Dear Experts, Please help to teach me how to add the filename into the file content. Actually the file name are EVENTS-20050912. ***************New output that I want*************** EVENTS-20050912 03:33:37 ALARM: BTSSPAN-277-1 30-18013 EVENTS-20050912 12:10:28 ALARM: BTSSPAN-297-2... (1 Reply)
Discussion started by: missutoomuch
1 Replies

3. Shell Programming and Scripting

adding a line to a file

I want to add a line at the beginning and at the end of a file.. e.g. echo "at the beginning.." > tmp_file && cat file >> tmp_file && echo "last line" >> tmp_file && mv tmp_file file is there a nice way for doing that?? Thx (2 Replies)
Discussion started by: andy2000
2 Replies

4. Shell Programming and Scripting

Grabing Date from filename and adding to the end of each line in the file.

Hi, I have 24 .dat files something like below. The file name starts with “abc” followed by two digit month and two digit year. Is there a way to grab the month and year from each filename and append it to the end of each line. Once this is done I want to combine all the files into file... (1 Reply)
Discussion started by: rkumar28
1 Replies

5. UNIX for Dummies Questions & Answers

Extract first line of a file and use as filename

I am trying to find a way to create a script which will extract the first line of a file and then rename the file (or create a new file with the same content as the old file) using the first line as the name. The first line being a single word, that is. I am hopeless at programming, if anyone can... (5 Replies)
Discussion started by: s.plumb
5 Replies

6. UNIX for Dummies Questions & Answers

Replacing first line of file by >filename

Hi All, I have a set of files named S5_SK1.chr01 S5_SK1.chr02 S5_SK1.chr03 ..... and the first line of these files is >SK1.chr01 >SK1.chr02 >SK1.chr03 ..... Can anyone suggest how I can change the first line of all these files with the filename itself? So my expected output for the first lines of... (14 Replies)
Discussion started by: pawannoel
14 Replies

7. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

8. Shell Programming and Scripting

Adding filename and line number from multiple files to final file

Hi all, I have 20 files (file001.txt upto file020.txt) and I want to read them from 3rd line upto end of file (line 1002). But in the final file they should appear to start from line 1. I need following kind of output in a single file: Filename Line number 2ndcolumn 4thcolumn I... (14 Replies)
Discussion started by: bioinfo
14 Replies

9. Shell Programming and Scripting

Adding new line to file

Hi everyone, currently I writing a script for comparing 2 variable in 2 line then output the line with equal value to new file. However, the new file only contain last line only, the earlier line was delete. I do google my problem but still not find the way out. Sorry for my English. Thank you... (10 Replies)
Discussion started by: lazy_bear
10 Replies

10. Shell Programming and Scripting

Adding line in a file using info from previous line

I have a shell script that looks something like the following: mysql -uroot db1 < db1.sql mysql -uroot db2 < db2.sql mysql -uroot db3 < db3.sql mysql -uroot db4 < db4.sql .... different db names in more than 160 lines. I want to run this script with nohup and have a status later. So,... (6 Replies)
Discussion started by: MKH
6 Replies
monodocs2html(1)					      General Commands Manual						  monodocs2html(1)

NAME
monodocs2html - Translate Monodoc XML to HTML SYNOPSIS
monodocs2html -source:SOURCE_DIR -dest:DEST_DIR [OPTIONS]* DESCRIPTION
monodocs2html has been obsoleted by mdoc(1). See the mdoc-export-html(1) man page. monodocs2html is a program that creates HTML documentation from the Monodoc documentation XML files. OPTIONS
-dest:DEST_DIR Write the HTML files into the directory DEST_DIR . -dumptemplate Dump the default page template to standard output so that you can use it as a base for a new template for use with the -template option. -ext:FILE_EXTENSION FILE_EXTENSION is the file extension for generated files. This defaults to html . -?, -help Show program argument information. -onlytype:TYPE Only generate HTML for the type TYPE . -source:SOURCE_DIR SOURCE_DIR is the base directory containing the Monodoc XML documentation. This directory should contain an index.xml file, the namespace-name.xml files (one for each namespace), and namespace-name directo- ries (one for each namespace), which will contain the type.xml files holding the monodoc documentation. -template:TEMPLATE Generate HTML using the page template TEMPLATE . -V, -version Display version and licensing information. TEMPLATE FORMAT
The template file is an XSLT which needs to process the following input XML document: <Page> <CollectionTitle>Collection Title</CollectionTitle> <PageTitle>Page Title</PageTitle> <Summary>Page Summary</Summary> <Signature>Type Declaration</Signature> <Remarks>Type Remarks</Remarks> <Members>Type Members</Members> <Copyright>Documentation Copyright</Copyright> </Page> The generated HTML also makes use of the following CSS classes, which should be defined so that output is nicely formatted: .CollectionTitle .PageTitle .Summary .Signature .Remarks .Members .Copyright .Section .SectionBox .NamespaceName .NamespaceSummary .MemberName .MemberSignature .MemberBox .Subsection .SubsectionBox .SignatureTable .EnumerationsTable .CodeExampleTable .MembersListing .TypesListing .InnerSignatureTable .TypePermissionsTable HTML LINKS
All members within the HTML file have a id attribute to permit linking to a specific member. The value of the id attribute is the String ID of the specified member. See the STRING ID FORMAT section of the monodocer man page for more information. MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/mono-docs-list for details. WEB SITE
Visit http://www.mono-project.com for details monodocs2html(1)
All times are GMT -4. The time now is 06:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy