Sponsored Content
Top Forums UNIX for Dummies Questions & Answers appending strings in the files Post 302109960 by dennis.jacob on Friday 9th of March 2007 06:34:50 AM
Old 03-09-2007
Try this...But this may not be the quickest way to do this..Also,I assume that all the files in the current directory requires this update


for i in $(ls * |sed -n '1!p'| sed -n '$!p')
do
[[ -f "$i" ]] && { echo "BOF$(cat $i)" > $i; echo "$(cat $i)EOF" >$i; }
done

echo "BOF$(ls *|sed -n '1p;')" >$(ls *|sed -n '1p;')
echo "$(ls *|sed -n '$p;')EOF" >$(ls *|sed -n '$p;')
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

appending files

I have 25 transaction files that need to be put into one file and have the date of the file appended at the end of the line, anyone got a one liner or simple script to help me out thanks - Ed (4 Replies)
Discussion started by: edog
4 Replies

2. UNIX for Dummies Questions & Answers

Appending the two files

hi, I want to append to two files into a third file without new line like this: file 1: I am learning the unix file 2: Unix is very intersting When I am trying cat file1 file2 >> file3 I am getting: I am learning the unix Unix is very interesting But I want that to be in... (3 Replies)
Discussion started by: harish409
3 Replies

3. Shell Programming and Scripting

appending strings to variable

is it possible? as i keep reading a file, i want one particular variable to keep storing the line that i've read so far (1 Reply)
Discussion started by: finalight
1 Replies

4. Shell Programming and Scripting

appending strings

Hi , while trying to append two strings, it is not properly coming. my code will be like this str1=_TrackingEAR srt2=1.0.0-20080523.155438-12 i am trying to build str3=$str1$str2.tgz but it is appending the last value ot the begingin of the string , but i expect to the end of the... (1 Reply)
Discussion started by: scorpio
1 Replies

5. Shell Programming and Scripting

Need assistance with appending strings using sed and variables

HI, Can't seem to find anything on the forums to fix this. I have a file, one line within this will not have a specific string at the end. I have the string, but need to append it to the specific line which has it missing. I need to use a variable for this, $string - I am using double... (13 Replies)
Discussion started by: mandriver
13 Replies

6. Shell Programming and Scripting

Appending two files vertically

Hi Need ur help for the below question. I have two files File-1 & File-2. File-1(This is a fixed file i.e. the content of this file is not going to change over a period of time) ------ a b c d e File-2 (This is a file which changes daily but the record count remains the same)... (1 Reply)
Discussion started by: 46019
1 Replies

7. Shell Programming and Scripting

appending two strings

Hi, I have a small doubt. Here is the code snippet for which the output that I'm getting are a bit surprising. testing.sh #!/bin/sh arg_1=$1 echo "arg passed by user is:${arg_1}" mapping=`grep ${arg_1}= testing.conf | awk -F"=" '{print $2}'` echo "mapping is $mapping"... (4 Replies)
Discussion started by: badrimohanty
4 Replies

8. UNIX for Dummies Questions & Answers

Appending two text files

Hi, i am using unix server and bash shell.. i have two csv files... i have file 1 as below... arun bvb ssx ccc and file 2 as below manas friu dfgg cat (3 Replies)
Discussion started by: arunmanas
3 Replies

9. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
XLITO(1)						      General Commands Manual							  XLITO(1)

NAME
xlito - Append/Delete/Show a Trailing Option string in a file. (XLoadImageTrailingOptions) SYNOPSIS
xlito [option] [string] files ... DESCRIPTION
xlito (XLoadImageTrailingOptions) is a utility that provides a file format independent way of marking image files with the appropriate options to display correctly. It does this by appending to a file, a string specified by the user. The string is marked with some magic numbers so that it can be extracted by a program that knows what to look for. Since almost all image files have some sort of image dimen- sion information in the file, the programs that load or manipulate these files generally do not look beyond the point at which they have read the complete image, so trailing information is safely be hidden. If appending this information causes trouble with other utilities, it can simply be deleted. Appropriate version of xloadimage (ie. xli 1.00) will recognise these trailing options at the end of the image files, and will treat the embedded string as if it were a sequence of command line Image Options. Any Global Options will be ignored, and unlike command line image Options, Trailing Options are never propagated to other images. Old versions of xloadimage (3.01 or less) can be made forward compatible by using the -x option to pull the trailing options out of the image files, and put them on the command line where xloadimage can see them. OPTIONS
The default behavior is to display the trailing option strings (if any) of the files on the argument line. The following options change the behavior of xlito: -c option_string file_name ... This adds or changes the embedded string to option_string. The string will have to be quoted if it is composed of more than one word. -d file_name ... Delete any embedded trailing option strings in the given files. -x file_name ... Process the files and create a command line string suitable for use by xloadimage. Arguments starting with - are echoed, arguments not starting with - are treated as files and any trailing options strings are echoed followed by the file name. The xloadimage option -name is treated correctly. EXAMPLES
If fred.gif has the wrong aspect ratio, then it might need viewing with the xloadimage options: xloadimage -yzoom 130 fred.gif This option can then be appended to the file by: xlito -c "-yzoom 130" fred.gif and from then on some new versions of xloadimage will get the appropriate options from the image file itself. Old versions of xloadimage can be made to work by using: xloadimage `xlito -x fred.gif` This can be made transparent by using a script containing something like: xloadimage `xlito -x $*` The script could be called xli for instance. The options can be deleted with: xlito -d fred.gif AUTHOR
Graeme Gill Labtam Australia graeme@labtam.oz.au MAINTAINER
smar@reptiles.org COMPATIBILITY WITH IMAGE FILES
Some image files are actually ascii files that are used in other contexts. X Bitmap files are an example. They are formatted as 'C' style #defines and an initialised array of characters, so that they can be included in 'C' source code. Adding trailing options would therefore render the file unusable with a compiler, since it will get a syntax error on the railing option string and the magic numbers. The solution to this is that xlito will ignore a certain amount (a few hundred bytes) after the trailing options, and uses a padding of 20 bytes before the trailing options. These two areas will be maintained when changing an existing trailing option. In the case of an X bitmap then, the solution is to edit the file and place the embedded string in some 'C' comments: eg: say the file starts as: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; and you add a trailing options: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; 01234567890123456789XXX xloadimage trailing options XXX0007"-smooth"0007XXX xloadimage trailing options XXX Then the trailing options can be commented out: #define tt_width 4 #define tt_height 4 static char tt_bits[] = { 0x08, 0x02, 0x04, 0x01}; /*234567890123456789XXX xloadimage trailing options XXX0007"-smooth"0007XXX xloadimage trailing options XXX */ BUGS
xlito doesn't cope with compressed files. A files will need uncompressing, the options added, and then compressing again. 7 Jul 1993 XLITO(1)
All times are GMT -4. The time now is 11:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy