Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using sed to insert at position x and then every interval y for each line Post 302924268 by gusbrown on Friday 7th of November 2014 12:20:23 PM
Old 11-07-2014
Thank you for the pointers, had to go all the way to 606 but it works a charm!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed - how to insert chars into a line

Hi I'm new to sed, and need to add characters into a specific location of a file, the fileds are tab seperated. text <tab> <tab> text <tab> text EOL I need to add more characters to the line to look like this: text <tab> <tab> newtext <tab> text <tab> text EOL Any ideas? (2 Replies)
Discussion started by: tangentviper
2 Replies

2. 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

3. Shell Programming and Scripting

search a line and insert string into specific at position

Hi, guys. I have one question: How can I search for a line with certain string in it and then insert a string into this line? For example: There is a file called shadow, the contents of it are below: ************************** ... yuanz:VIRADxMsadfDF/Q:0:0:50:7:::... (9 Replies)
Discussion started by: daikeyang
9 Replies

4. Shell Programming and Scripting

sed insert text at particular line

I know that sed -n '12p' file will print line 12 but how might I insert text to a specified line? thanks (2 Replies)
Discussion started by: action_owl
2 Replies

5. AIX

insert a line with variables using sed

Hi, I have to insert a line having variables using sed. But the variables are not getting substituted within sed. Ex: n=2 sed $n' i\ hi' file This works. But the below code does not work. n=2 line=hello sed $n' i\ $line' file The above code inserts '$line' in the 2nd line of the... (9 Replies)
Discussion started by: sugan
9 Replies

6. Shell Programming and Scripting

Insert @Line # - SED (non-GNU)

Just posted on another fellow's question using ed, but I wanted to know about doing it with sed on Unix. For example - I have a file of an unknown length, but I want to add a line after the shell declaration (Line 2). If possible, I'd like the example to be able to just substitute in a number and... (2 Replies)
Discussion started by: Vryali
2 Replies

7. Shell Programming and Scripting

Insert carriage return on the 10th char position of each line

Hi experts, Need your help on how to insert carriage return after the 10th char position of each line in a file and then add two blank spaces after the carriage return. Example: >cat test.txt testingline dummystring samplesample teststringline Expected output should be.. ... (2 Replies)
Discussion started by: brichigo
2 Replies

8. Shell Programming and Scripting

Insert charactera in 1st position of specific lines using vi editor or sed command

Dear all, i am having text file like below surya rama ranga laxman rajesh reddy i want add string (OK) before a text from line 3 to 5 the result will be surya rama OK ranga OK laxman OK rajesh reddy (1 Reply)
Discussion started by: suryanarayana
1 Replies

9. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

10. Solaris

sed insert into line 1 via script

Hi I am trying to run a sed command within a script..unfortunately it wasn't written on Solaris so doesn't work. Can anyone help with the correct coding please? It is: sed -i '1i ROWID;ORDER_ID;JOB_NAME;ORDER_TABLE' ${OUTFILE} (4 Replies)
Discussion started by: Grueben
4 Replies
insque(3)						     Library Functions Manual							 insque(3)

NAME
insque, remque - Inserts or removes an element in a queue LIBRARY
Standard C Library (libc.a, libc.so) SYNOPSIS
#include <search.h> void insque( void *element, void *pred); void remque( void *element); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: insque(), remque(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the element in the queue immediately before the element to be inserted. Points to the element to be inserted or deleted. DESCRIPTION
The insque() and remque() functions manipulate queues built from doubly-linked lists. The queue can be either circular or linear. An application using these functions must define a structure in which the first two members are pointers to the same type of structure and any further members are application-specific. The first member of the structure is a forward pointer to the next entry in the queue. The second member is a backward pointer to the previous entry in the queue. If the queue is linear, it is terminated with null pointers. The insque() function inserts the element pointed to by element into a queue immediately after the element pointed to by pred. The remque() function removed the element pointed to by element from a queue. When using the queue as a linear list, the forward and backward pointers of element can be initialized to null pointers by invoking insque (&element, NULL); where element is the initial element of the queue. When using the queue as a circular list, the application must initialize the forward pointer and the backward pointer of the initial ele- ment of the queue to the element's own address. RETURN VALUES
The insque() and remque() functions do not return a value. RELATED INFORMATION
Standards: standards(5) delim off insque(3)
All times are GMT -4. The time now is 04:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy