Sponsored Content
Top Forums Shell Programming and Scripting insert character in particular position. Post 302476641 by R0H0N on Thursday 2nd of December 2010 06:54:02 AM
Old 12-02-2010
You can use recording in Vi Editor.

Its very simple. Perform following steps.

1.> Open input file in Vi Editor.
2.> Go to first line, first character using ":1"
3.> Start recording using "qq"
4.> Move to the 7th character of line.
5.> Enter into edit mode by pressing "insert" or "i"
6.> Type your character.
7.> Press Esc
8.> Move to first character by pressing "Shift+^"
9.> Move to next line's first character.
10.> Press q to quit from recording mode.

Now play whatever you have recorded for any number of times you want.
For example, if you want to repeat this for 10 times then type "10@q"
R0H0N
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert strings at certain position

Hi, I need to insert strings "0000 00" at the each line within the file. The postion is 37 to 42. ex. name1 name2 0000 00 nam name 0000 00 The "0000 00" in two lines should be lined up. I don't know why it's not lined up when I posted it. Can anyone help? (14 Replies)
Discussion started by: whatisthis
14 Replies

2. HP-UX

find the position in a file and insert the data there

Hi, I have a EDI data file ARROWTEST of size 18246 characters. And I want to insert some data after 4200 position in the file. How I can find the position 4200 in that file....Please advise. Regards, (5 Replies)
Discussion started by: isingh786
5 Replies

3. Shell Programming and Scripting

How to insert at a particular position in flat file

Hi All, I have a flat file with ~ as de-limiter (e.g: aaa~ba a~caa~0~d~e) What I want is check if the 4th character is 0 and replace it with say 4. So now it becomes : aaa~ba a~caa~4~d~e. I have to do this for the whole file, but the delimiter position remains the same, not the... (10 Replies)
Discussion started by: akdwivedi
10 Replies

4. Shell Programming and Scripting

insert server name in position 1 on each line

Hello, It has been a long time since I have written unix code and I need to insert a variable into the first position of each line in a file. Below is an example of the script and the desired output file Here is my short script server="$(hostname)" df -kg | awk '{print $1, $2, $3, $4,... (3 Replies)
Discussion started by: rlc198842
3 Replies

5. Shell Programming and Scripting

Insert character in a specific position of a file

Hi, I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this? I tried to add it at 5th position using the below code. It didnt work. Please help!!! awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Discussion started by: gpaulose
1 Replies

6. Shell Programming and Scripting

Find character and Replace character for given position

Hi, i want find the character '-' in a file from position 284-298, if it occurs i need to replace it with 'O ' for the position in the file. How to do that using SED command. thanks in advance, Sara (9 Replies)
Discussion started by: Sara183
9 Replies

7. Shell Programming and Scripting

Insert | in specific position

Hi , I have a file which has line similar to below 13123324234234234234234234234234234 3454546456dfhgfhgh454645654asdasfsdsddfgdgdfg 345345345mnmnbmnb346mnb4565464564564645645 Not for each line for specific position I need to insert some '|' Positions are fixed. Like 3,5,9,11 So the... (5 Replies)
Discussion started by: Anupam_Halder
5 Replies

8. Shell Programming and Scripting

How to insert a '#' in the first position of all the files?

Hi All, how to insert a '#' in the first position of all the files based on a certain condition. I tried this: cat /bin/user/input_file.txt | while read a do b=`sed 's/.*song=good.*/\#&/g' $a ` echo $b > /bin/user/new/output_file.txt done input_file.txt has list of names of 10... (5 Replies)
Discussion started by: anand787
5 Replies

9. UNIX for Dummies Questions & Answers

Using sed to insert at position x and then every interval y for each line

Thanks to help from Don Cragun in post 302924174, I'm off and getting into trouble on my own (finally) with sed. Here is my goal - insert \\r\n at the 60th character on each line and then every 76th character thereafter: Input:... (3 Replies)
Discussion started by: gusbrown
3 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
form_driver(3CURSES)					     Curses Library Functions					      form_driver(3CURSES)

NAME
form_driver - command processor for the forms subsystem SYNOPSIS
cc [ flag... ] file... -lform -lcurses [ library... ] #include <form.h> int form_driver(FORM *form, int c); DESCRIPTION
The form_driver() function is the workhorse of the forms subsystem; it checks to determine whether the character c is a forms request or data. If it is a request, the form driver executes the request and reports the result. If it is data (a printable ASCII character), it enters the data into the current position in the current field. If it is not recognized, the form driver assumes it is an application- defined command and returns E_UNKNOWN_COMMAND. Application defined commands should be defined relative to MAX_COMMAND, the maximum value of a request listed below. Form driver requests: REQ_NEXT_PAGE Move to the next page. REQ_PREV_PAGE Move to the previous page. REQ_FIRST_PAGE Move to the first page. REQ_LAST_PAGE Move to the last page. REQ_NEXT_FIELD Move to the next field. REQ_PREV_FIELD Move to the previous field. REQ_FIRST_FIELD Move to the first field. REQ_LAST_FIELD Move to the last field. REQ_SNEXT_FIELD Move to the sorted next field. REQ_SPREV_FIELD Move to the sorted prev field. REQ_SFIRST_FIELD Move to the sorted first field. REQ_SLAST_FIELD Move to the sorted last field. REQ_LEFT_FIELD Move left to field. REQ_RIGHT_FIELD Move right to field. REQ_UP_FIELD Move up to field. REQ_DOWN_FIELD Move down to field. REQ_NEXT_CHAR Move to the next character in the field. REQ_PREV_CHAR Move to the previous character in the field. REQ_NEXT_LINE Move to the next line in the field. REQ_PREV_LINE Move to the previous line in the field. REQ_NEXT_WORD Move to the next word in the field. REQ_PREV_WORD Move to the previous word in the field. REQ_BEG_FIELD Move to the first char in the field. REQ_END_FIELD Move after the last char in the field. REQ_BEG_LINE Move to the beginning of the line. REQ_END_LINE Move after the last char in the line. REQ_LEFT_CHAR Move left in the field. REQ_RIGHT_CHAR Move right in the field. REQ_UP_CHAR Move up in the field. REQ_DOWN_CHAR Move down in the field. REQ_NEW_LINE Insert/overlay a new line. REQ_INS_CHAR Insert the blank character at the cursor. REQ_INS_LINE Insert a blank line at the cursor. REQ_DEL_CHAR Delete the character at the cursor. REQ_DEL_PREV Delete the character before the cursor. REQ_DEL_LINE Delete the line at the cursor. REQ_DEL_WORD Delete the word at the cursor. REQ_CLR_EOL Clear to the end of the line. REQ_CLR_EOF Clear to the end of the field. REQ_CLR_FIELD Clear the entire field. REQ_OVL_MODE Enter overlay mode. REQ_INS_MODE Enter insert mode. REQ_SCR_FLINE Scroll the field forward a line. REQ_SCR_BLINE Scroll the field backward a line. REQ_SCR_FPAGE Scroll the field forward a page. REQ_SCR_BPAGE Scroll the field backward a page. REQ_SCR_FHPAGE Scroll the field forward half a page. REQ_SCR_BHPAGE Scroll the field backward half a page. REQ_SCR_FCHAR Horizontal scroll forward a character. REQ_SCR_BCHAR Horizontal scroll backward a character REQ_SCR_HFLINE Horizontal scroll forward a line. REQ_SCR_HBLINE Horizontal scroll backward a line. REQ_SCR_HFHALF Horizontal scroll forward half a line. REQ_SCR_HBHALF Horizontal scroll backward half a line. REQ_VALIDATION Validate field. REQ_PREV_CHOICE Display the previous field choice. REQ_NEXT_CHOICE Display the next field choice. RETURN VALUES
The form_driver() function returns one of the following: E_OK The function returned successfully. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An argument is incorrect. E_NOT_POSTED The form is not posted. E_INVALID_FIELD The field contents are invalid. E_BAD_STATE The routine was called from an initialization or termination function. E_REQUEST_DENIED The form driver request failed. E_UNKNOWN_COMMAND An unknown request was passed to the form driver. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), forms(3CURSES), attributes(5) NOTES
The header <form.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.11 31 Dec 1996 form_driver(3CURSES)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy