Sponsored Content
Operating Systems AIX How to edit txt file by shell script? Post 53623 by dupeng on Wednesday 21st of July 2004 03:24:10 AM
Old 07-21-2004
How to edit txt file by shell script?

What I want to do is just delete some lines from a text file, I know it's easy using copy and redirect function, but what I have to do is edit this file (delete the lines) directly, as new lines may be added to the text file during this period. Can AIX do this ?

# cat text

1:line1
2:line2
3:line3
4:line4

# xxxx.sh text <---- Is it possible?

#cat text

1:line1
2:line4
3:new line added by other processes
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Edit txt file using vi editor

Dear All I have a file called sample.txt which contains as follows HR Files records Loaded RecordDate Unloaded -- ---- -------- --------- ------------ ------ 00 567 77777 67896 0 0 01 345 345567 45678 0 ... (1 Reply)
Discussion started by: tkbharani
1 Replies

2. Shell Programming and Scripting

shell script to edit the content of a file

Hi I need some help using shell script to edit a file. My original file has the following format: /txt/email/myemail.txt /txt/email/myemail2.txt /pdf/email/myemail.pdf /pdf/email/myemail2.pdf /doc/email/myemail.doc /doc/email/myemail2.doc I need to read each line. If the path is... (3 Replies)
Discussion started by: tiger99
3 Replies

3. Shell Programming and Scripting

Edit a config file using shell script

I need to edit a config file using shell script. i.e., Search with the 'key' string and edit the 'value'. For eg: below is what I have in the config file "configfile.cfg". Key1=OldValue1 Key2=OldValue2 I want to search for "Key1" and change "OldValue1" to "NewValue1" Thanks for your... (7 Replies)
Discussion started by: rajeshomallur
7 Replies

4. Shell Programming and Scripting

How to edit a txt file ?

Hi, I need to edit a text file which is like this.. -- D3341000600 AGEC901164 XYZ SE0109 1RNVX AH 2009-01-19 2009-01-11 2009-01-21 -- D3341000600 AGEC901164 XYZ SE0109 1RNVX AH 2009-01-19 2009-01-11 2009-01-21 -- D3341006000 AGEC921472 ... (4 Replies)
Discussion started by: RRVARMA
4 Replies

5. Shell Programming and Scripting

Shell script to edit a file

Hello, I have a big file in wich I would like to rename inside this exactly the string '_ME' and not rename in case we have 'ABC_MELANGE'. Is there a way to do it by using a shell script? Any tip will be apreciated. The file is like described bellow, after using command more filename : ... (3 Replies)
Discussion started by: Titas
3 Replies

6. Shell Programming and Scripting

shell script to edit a file

i have a file called number which contains data as 1 2 3 4 5 6 7 8 9 0 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 needed a shell script to print the output as 1 7 7 1 4 and (2 Replies)
Discussion started by: jacky29
2 Replies

7. Homework & Coursework Questions

Edit the file in shell script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to automate hadoop installation procedure using shell script. It involves go to perticular directory... (3 Replies)
Discussion started by: Abdul Navaz
3 Replies

8. Shell Programming and Scripting

To transpose columns + edit in a txt file

Hi, I have a txt file that looks like log2FoldChange Ontology_term 8.50624450251828 GO:0003700,GO:0003707,GO:0005634,GO:0006355,GO:0043401,GO:0003700,GO:0005634,GO:0006355,GO:0008270,GO:0043565 7.03936870356684 GO:0005515,GO:0008080 6.49606183738682 6.49525073909629 GO:0005515... (4 Replies)
Discussion started by: alisrpp
4 Replies

9. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies

10. Shell Programming and Scripting

Open and edit a file using a shell script

Hello Folks, I have a file named as date.dat present at /tmp/abc location which has following data - 20161030,20161031,20161101 I need to remove this line and replace it with something like below - $param1,$param2,$param3 Param1, Param2 and param3 stores the date based on some calculation in... (1 Reply)
Discussion started by: ektubbe
1 Replies
TextDisplay(3I) 					    InterViews Reference Manual 					   TextDisplay(3I)

NAME
TextDisplay - unstructured text display SYNOPSIS
#include <InterViews/textdisplay.h> DESCRIPTION
A TextDisplay manages and displays an array of lines of text. Operations are provided to insert and delete lines, to insert and delete text within a line, and to scroll the display. TextDisplays are typically used to implement interactors that require non-trivial display of unstructured text. The array is addressed by a line number and an index into the line. Text can be inserted or deleted at arbitrary positions. By default, the first character in line number zero is positioned with its top left corner at the top left corner of the TextDisplay. The display is automatically updated following modifications to the text or when scrolling. Each character in the array has an associated text style. Operations are provided to apply, add, or remove font styles to a range of the text. TextDisplay can be used with both constant-width and proportionally-spaced fonts and with arbitrary geometric transformations. PUBLIC OPERATIONS
TextDisplay() ~TextDisplay(boolean autosized = false) Create or destroy a TextDisplay. If autosized is true, the TextDisplay will automatically grow its size as text is added. The default is to keep the size constant. void LineHeight(Coord lineheight) void TabWidth(Coord tabwidth) Lines of text will be positioned with baselines separated by lineheight. Tab characters in the text will cause the following char- acter to be positioned an integral multiple of tabwidth from the beginning of the line. void Resize(Coord xmin, Coord ymin, Coord xmax, Coord ymax) void Bounds(Coord& xmin, Coord& ymin, Coord& xmax, Coord& ymax) Specify or query the size of the display. Only lines of text that fall completely inside the specified region will be displayed. TextDisplay will not draw on any part of the canvas outside the specified bounds. Conversely, TextDisplay is free to draw on any part of the canvas within the specified bounds. void Draw(Painter*, Canvas*) Specify the painter and canvas to use for drawing operations; the painter specifies the font, colors, and geometric transformation. Draw should be called before performing any operation on the TextDisplay which produces output or requires graphical information, or when there is a possibility that the painter or canvas has changed since the function was last called. void Redraw(Coord left, Coord bottom, Coord right, Coord top) Redraw a specified region of the display. void Scroll(int line, Coord x, Coord y) Scroll the display so that line line is positioned with its upper-left corner at (x, y). There are no restrictions on the argu- ments: it is possible to scroll the display so that no lines are visible. void InsertLinesAfter(int line, int count) void InsertLinesBefore(int line, int count) void DeleteLinesAfter(int line, int count) void DeleteLinesBefore(int line, int count) Insert or delete whole lines of text. Line line is not affected by the operation. Other lines will move up or down to accommodate the changes. Newly inserted lines are blank. The specified line need not refer to an existing line. void InsertText(int line, int index, const char*, int count) void DeleteText(int line, int index, int count) void ReplaceText(int line, const char*, int count) Modify the text within line line. InsertText and DeleteText will cause the following characters on the line to move to accommodate the changes. ReplaceText replaces the entire text of the line. If the specified line is non-existent, a new line will be created. void Style(int line1, int index1, int line2, int index2, int style) void AddStyle(int line1, int index1, int line2, int index2, int style) void RemoveStyle(int line1, int index1, int line2, int index2, int style) Modify the styling of a range of text. Style replaces any existing style; AddStyle adds style style in addition to any existing styles; RemoveStyle removes style style without affecting other existing styles. Styles are specified as any combination of the constants Plain, Boldface, Underlined, and Reversed. void CaretStyle(int style) void Caret(int line, int index) Control the shape and position of a caret. Valid caret styles are currently NoCaret, BarCaret, UnderscoreCaret and OutlineCaret. TextDisplay does not automatically adjust the position of the caret following insertions and deletions. int LineNumber(Coord y) int LineIndex(int line, Coord x) Map x and y display coordinates into line and index text coordinates. LineNumber returns the number of the line that contains the specified vertical position y. LineIndex returns the index into line line that best corresponds to the specified horizontal posi- tion x. Coord Width() Coord Height() Return the width or the height of the text currently displayed by the TextDisplay. Width returns the width of the longest line in the display. Height returns the distance from the top of the topmost line to the bottom of the bottommost line. Note that these dimensions do not necessarily correspond to the TextDisplay's bounds as returned by Bounds. Coord Base(int line) Coord Top(int line) Coord Left(int line, int index) Coord Right(int line, int index) Map line and index text coordinates into x and y display coordinates. The return values define a bounding box for the character specified by line and index. SEE ALSO
Painter(2I), Canvas(2I) InterViews 23 May 1989 TextDisplay(3I)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy