Sponsored Content
Top Forums Shell Programming and Scripting Add end of char \n on end of file Post 302298040 by svenkatareddy on Monday 16th of March 2009 01:04:04 PM
Old 03-16-2009
Add end of char \n on end of file

Hi,

I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this?

when I use command
Code:
echo "1\n" > a.txt

and
Code:
od -c a.txt
0000000   1  \n  \n
0000003

How does it differentiate \n and eof in this case?


Regards,
Venkat
 

10 More Discussions You Might Find Interesting

1. HP-UX

Add a column at the end of all the lines in a file

Hi Guys, :D I am very much new to UNIX. I dont have much basics of coding in UNIX, so please help me out of thi ssituation. I have a file say for ex: ABC.dtd and it contains "|" delimited data as test1|testing|test3|moving past1|runing|test4|going I need to add a column at the end... (6 Replies)
Discussion started by: ruthless
6 Replies

2. UNIX for Dummies Questions & Answers

moving char to end

I need to move the 5th char of a word to its end and first four chars and rest should be retained as it is. Can any one help me out... (1 Reply)
Discussion started by: Ramkum
1 Replies

3. Shell Programming and Scripting

add character to the end of each line in file

hi all i have 32 lines in file. the length of each line is 82 , i want that in the end of each line , means in postion 83-84 to put two characters 0d(=\015), 0a(=\012) i want that the 0d will be in postion 83 and the 0a will be in postion 84 in each line of the file how shall i do it ? ... (7 Replies)
Discussion started by: naamas03
7 Replies

4. Shell Programming and Scripting

Add a space at end of file

Hi I guess this is very simple.... I want to add a space at the last line in a file. The space has to be the last charachter on the last line, not at a new line. Anyone ?? (7 Replies)
Discussion started by: disel
7 Replies

5. Shell Programming and Scripting

Append char to the end of string from Nth column

I'm sure this is easy to do but I can't find a one line command with awk or sed to append a char to the end of the string from Nth column. Any sugestion please? Thanks (2 Replies)
Discussion started by: cabrao
2 Replies

6. Shell Programming and Scripting

Remove special char from end of the file

Hi I am working on a bash script and would know how to use cut or sed to remove (F/.M/d h) from a text file. Before 1 text to save (F/.M/d h) after 1 text to save Thanks in advance (5 Replies)
Discussion started by: pelle
5 Replies

7. UNIX for Dummies Questions & Answers

Add blank line to end of file

Alright, so I was looking around a bit on the forum before posting and still don't really understand so I figured I'd post my own question. I am appending two files using cat file_1.txt >> file_2.txt The problem is that I need a blank line in between the two different text files and it does... (2 Replies)
Discussion started by: cgagnon
2 Replies

8. UNIX Desktop Questions & Answers

add char o end of line if dosent exist

hey , i want to check if the char "#" exist at the end of every line of txt file and if it dosent then add it for example: the cat jumped on my mom # cars can run on water# i cant get a date blue yellow# will be: the cat went back home# cars can run on water# i cant get a... (2 Replies)
Discussion started by: boaz733
2 Replies

9. Shell Programming and Scripting

Add name at the end of line in one file

Hi Folks, I want to add one name at the end of one file. Below line i have to add end of line some name... Search_masterlogin=`grep -i $masterlogin passwd.master|awk -F: '{print $1}'` $ grep -i susan passwd.master |awk -F: '{print $1}' susan $ I want to insert one name called... (10 Replies)
Discussion started by: susindram
10 Replies

10. Shell Programming and Scripting

Need to add a numeric & special char to end of the first line

Need to add a numeric & special char to end of the first line Existing file: 12-11-16|11 2016 Jan 12:34:55|03:55| 13-10-16|10 2016 Jan 12:34:55|03:55|12-11-16|11 2016 Jan 12:34:55|03:55| 14-10-16|19 2016 Jan 12:34:55|03:55|13-11-16|11 2016 Jan 12:34:55|04:55| 15-10-16|18 2016 Jan... (11 Replies)
Discussion started by: Joselouis
11 Replies
panedwindow(1)							  [incr Widgets]						    panedwindow(1)

__________________________________________________________________________________________________________________________________________________

NAME
panedwindow - Create and manipulate a paned window widget SYNOPSIS
panedwindow pathName ?options? INHERITANCE
itk::Widget <- panedwindow STANDARD OPTIONS
background cursor See the "options" manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS Name: height Class: Height Command-Line Switch: -height Specifies the overall height of the paned window in any of the forms acceptable to Tk_GetPixels. The default is 10 pixels. Name: orient Class: Orient Command-Line Switch: -orient Specifies the orientation of the separators: vertical or horizontal. The default is horizontal. Name: sashBorderWidth Class: BorderWidth Command-Line Switch: -sashborderwidth Specifies a value indicating the width of the 3-D border to draw around the outside of the sash in any of the forms acceptable to Tk_GetPixels. The default is 2 pixels. Name: sashCursor Class: Cursor Command-Line Switch: -sashcursor Specifies the type of cursor to be displayed in the sash. The default is crosshair. Name: sashHeight Class: Height Command-Line Switch: -sashheight Specifies the height of the sash in any of the forms acceptable to Tk_GetPixels. The default is 10 pixels. Name: sashIndent Class: SashIndent Command-Line Switch sashindent Specifies the placement of the sash along the panes in any of the forms acceptable to Tk_GetPixels. A positive value causes the sash to be offset from the near (left/top) side of the pane, and a negative value causes the sash to be offset from the far (right/bottom) side. If the offset is greater than the width, then the sash is placed flush against the side. The default is -10 pixels. Name: sashWidth Class: Width Command-Line Switch: -sashwidth Specifies the width of the sash in any of the forms acceptable to Tk_GetPixels. The default is 10 pixels. Name: thickness Class: Thickness Command-Line Switch: -thickness Specifies the thickness of the separators in any of the forms acceptable to Tk_GetPixels. The default is 3 pixels. Name: width Class: Width Command-Line Switch: -width Specifies the overall width of the paned window in any of the forms acceptable to Tk_GetPixels. The default is 10 pixels. __________________________________________________________________________________________________________________________________________________ DESCRIPTION
The panedwindow command creates a multiple paned window widget capable of orienting the panes either vertically or horizontally. Each pane is itself a frame acting as a child site for other widgets. The border separating each pane contains a sash which allows user positioning of the panes relative to one another. METHODS
The panedwindow command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form: pathName option ?arg arg ...? Option and the args determine the exact behavior of the command. Many of the widget commands for the panedwindow take as one argument an indicator of which pane of the paned window to operate on. These indicators are called indexes and allow reference and manipulation of panes regardless of their current map state. Paned window indexes may be specified in any of the following forms: number Specifies the pane numerically, where 0 corresponds to the nearest (top/left-most) pane of the paned window. end Indicates the farthest (bottom/right-most) pane of the paned window. pattern If the index doesn't satisfy one of the above forms then this form is used. Pattern is pattern-matched against the tag of each pane in the panedwindow, in order from left/top to right/left, until a matching entry is found. The rules of Tcl_StringMatch are used. WIDGET-SPECIFIC METHODS pathName add tag ?option value option value? Adds a new pane to the paned window on the far side (right/bottom). The following options may be specified: -margin value Specifies the border distance between the pane and pane contents is any of the forms acceptable to Tk_GetPixels. The default is 8 pixels. -minimum value Specifies the minimum size that a pane's contents may reach not inclusive of twice the margin in any of the forms acceptable to Tk_GetPixels. The default is 10 pixels. The add method returns the path name of the pane. pathName cget option Returns the current value of the configuration option given by option. Option may have any of the values accepted by the panedwin- dow command. pathName childsite ?index? Returns a list of the child site path names or a specific child site given an index. The list is constructed from the near side (left/top) to the far side (right/bottom). pathName configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the panedwindow command. pathName delete index Deletes a specified pane given an index. pathName fraction percentage percentage ?percentage percentage ...? Sets the visible percentage of the panes. Specifies a set of percentages which are applied to the visible panes from the near side (left/top). The number of percentages must be equal to the current number of visible (mapped) panes and add up to 100. pathName hide index Changes the visiblity of the specified pane, allowing a previously displayed pane to be visually removed rather than deleted. pathName index index Returns the numerical index corresponding to index. pathName insert index tag ?option value option value ...? Same as the add command except that it inserts the new pane just before the one given by index, instead of appending to the end of the panedwindow. The option, and value arguments have the same interpretation as for the add widget command. pathName paneconfigure index ?options? This command is similar to the configure command, except that it applies to the options for an individual pane, whereas configure applies to the options for the paned window as a whole. Options may have any of the values accepted by the add widget command. If options are specified, options are modified as indicated in the command and the command returns an empty string. If no options are specified, returns a list describing the current options for entry index (see Tk_ConfigureInfo for information on the format of this list). pathName reset Redisplays the pane window using default percentages. pathName show index Changes the visiblity of the specified pane, allowing a previously hidden pane to be displayed. NOTES
Dynamic changing of the margin and or minimum options to values which make the current configuration invalid will block subsequent sash movement until the fractions are modified via the fraction method. For example a panedwindow is created with three panes and the minimum and margin options are at their default settings. Next the user moves the sashes to compact the panes to one side. Now, if the minimum is increased on the most compressed pane via the paneconfigure method to a large enough value, then sash move- ment is blocked until the fractions are adjusted. This situation is unusual and under normal operation of the panedwindow, this problem will never occur. EXAMPLE
panedwindow .pw -width 300 -height 300 .pw add top .pw add middle -margin 10 .pw add bottom -margin 10 -minimum 10 pack .pw -fill both -expand yes foreach pane [.pw childSite] { button $pane.b -text $pane -relief raised -borderwidth 2 pack $pane.b -fill both -expand yes } .pw fraction 50 30 20 .pw paneconfigure 0 -minimum 20 .pw paneconfigure bottom -margin 15 ACKNOWLEDGEMENTS
: Jay Schmidgall 1994 - Base logic posted to comp.lang.tcl Joe Hidebrand <hildjj@fuentez.com> 07/25/94 - Posted first multipane version to comp.lang.tcl 07/28/94 - Added support for vertical panes Ken Copeland <ken@hilco.com> 09/28/95 - Smoothed out the sash movement and added squeezable panes. AUTHOR
Mark L. Ulferts KEYWORDS
panedwindow, widget Tk panedwindow(1)
All times are GMT -4. The time now is 11:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy