Sponsored Content
Top Forums Shell Programming and Scripting Inserting a line when its length is variable Post 302361030 by jp2542a on Monday 12th of October 2009 02:31:13 AM
Old 10-12-2009
Your definition is not very clear and test data very limited , but try this:

Code:
awk '(NR==FNR) {A=$1} (NR!=FNR) & (FNR != 28) {FS=","; print;} (NR!=FNR) & (FNR==28) { $2 = A/3 + 1; $NF=A; print}'  file1 file2

where file1 is the first file with the last line of interest and file 2 is the file with the line you want to replace.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

3. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

4. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

5. Shell Programming and Scripting

inserting a variable to a new line

In my script I am using sed to insert a line. Suppose I have a variable called ck_size=5 and a temporary file called tmp I want to add a certain line in the tmp file .Please see the below command sed -i '2a\maitee is $ck_size' /dun/homes/lrsprod/tmp I want in 2 line of tmp file... (7 Replies)
Discussion started by: maitree
7 Replies

6. UNIX for Dummies Questions & Answers

print variable length text from the middle of a line?

I am trying to get text from a webpage, in terminal form. So far I am: 1. getting the html for the page printed using curl (curl -s webpage.com), which is then 2. piped to awk, printing line number 29 (awk NR==29), then 3. this is where I am sort of lost. I know where in the printed line I... (7 Replies)
Discussion started by: darkfalz
7 Replies

7. Shell Programming and Scripting

Check for length which exceeds specified length in a line

Hi, I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string. But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields. For ex: Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies

8. Shell Programming and Scripting

Commenting a specific line and inserting a new line after commented line.

Hello All, I have following file contents cat file #line=aaaaaa #line=bbbbbb #line=cccccc #line=dddddd line=eeeeee #comment=11111 #comment=22222 #comment=33333 #comment=44444 comment=55555 Testing script Good Luck! I would like to comment line line=eeeeee and insert a new line... (19 Replies)
Discussion started by: manishdivs
19 Replies

9. UNIX for Dummies Questions & Answers

Help with awk, where line length and field position are variable

I have several questions about using awk. I'm hoping someone could lend me a hand. (I'm also hoping that my questions make sense.) I have a file that contains pipe separated data. Each line has similar data but the number of fields and the field position on each line is variable. ... (3 Replies)
Discussion started by: Cheese64
3 Replies

10. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
ttk::label(n)							 Tk Themed Widget						     ttk::label(n)

__________________________________________________________________________________________________________________________________________________

NAME
ttk::label - Display a text string and/or image SYNOPSIS
ttk::label pathName ?options? _________________________________________________________________ DESCRIPTION
A ttk::label widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. STANDARD OPTIONS
-class -compound -cursor -image -style -takefocus -text -textvariable -underline -width See the ttk_widget manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-anchor anchor] Specifies how the information in the widget is positioned relative to the inner margins. Legal values are n, ne, e, se, s, sw, w, nw, and center. See also -justify. [-background frameColor] The widget's background color. If unspecified, the theme default is used. [-font font] Font to use for label text. [-foreground textColor] The widget's foreground color. If unspecified, the theme default is used. [-justify justify] If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of left, center, or right. See also -anchor. [-padding padding] Specifies the amount of extra space to allocate for the widget. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. [-relief relief] Specifies the 3-D effect desired for the widget border. Valid values are flat, groove, raised, ridge, solid, and sunken. [-text text] Specifies a text string to be displayed inside the widget (unless overridden by -textvariable). [-wraplength wrapLength] Specifies the maximum line length (in pixels). If this option is less than or equal to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the speci- fied value. WIDGET COMMAND
Supports the standard widget commands configure, cget, identify, instate, and state; see ttk::widget(n). SEE ALSO
ttk::widget(n), label(n) Tk 8.5 ttk::label(n)
All times are GMT -4. The time now is 11:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy