Sponsored Content
Top Forums Shell Programming and Scripting Appending string (charachters inside the line) to a fixed width file using awk or sed Post 302378474 by Franklin52 on Tuesday 8th of December 2009 02:31:47 AM
Old 12-08-2009
Wrench

Something like this?

Code:
awk '{$0=substr($0,1,i++) substr($0,17,2) substr($0,i)}1' file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Fixed Width file using AWK

I am using the following command at the Unix prompt to make my 'infile' into a fixed width file of 100 characters. awk '{printf "%-100s\n",$0}' infile > outfile However, there are some records with a special character "©" These records are using 3 characters in place of one and my record... (2 Replies)
Discussion started by: alok.benjwal
2 Replies

2. UNIX for Dummies Questions & Answers

SED or AWK: Appending a line Identifier that changes with paragraph?

Have another question that has been eluding me all day. I have data file I'm trying to reformat so that each line is appended with an ID code, but the ID code needs to update as it searches through the file. I.e. ----Begin Original Datafile----- Condition = XXX Header Line 1 Header... (1 Reply)
Discussion started by: selkirk
1 Replies

3. Shell Programming and Scripting

edit entire column from a fixed-width file using awk or sed

Col1 Col2 Col3 Col4 12 Completed 08 0830 12 In Progress 09 0829 11 For F U 07 0828 Considering the file above, how could i replace the third column the most efficient way? The actual file size is almost 1G. I am... (10 Replies)
Discussion started by: tamahomekarasu
10 Replies

4. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

5. Shell Programming and Scripting

Fixed Width Join & Pad Sed/Awk Help

I was wondering someone might be able to push me in the right direction, I am writing a script to modify fixed-width spool files, As you can see below the original spool file broke a single line into two for printability sake. I have had been able do the joins using sed, the thing I am... (10 Replies)
Discussion started by: Cho Nagurai
10 Replies

6. Shell Programming and Scripting

awk: creating a fixed-width single file from 2 different files

I have to create a single file from three files, Please see below for samples: day.txt 20090101 20090102 item.txt 123456789101 12345678910209 1234567891 str.txt 1 12 123 output.txt 20090101123456789101 1 0 2009010112345678910209 12 ... (2 Replies)
Discussion started by: tamahomekarasu
2 Replies

7. Shell Programming and Scripting

Remove new line character and add space to convert into fixed width file

I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file. If the length is less than the max length, the spaces should be appended... (4 Replies)
Discussion started by: Amrutha24
4 Replies

8. Shell Programming and Scripting

Print column details from fixed width file using awk command

hi, i have a fixed width file with multiple columns and need to print data using awk command. i use: awk -F "|" '($5 == BH) {print $1,$2,$3}' <non_AIM target>.txt for a delimiter file. but now i have a fixed width file like below: 7518 8269511BH 20141224951050N8262 11148 8269511BH... (5 Replies)
Discussion started by: kcdg859
5 Replies

9. Shell Programming and Scripting

Replace using awk on fixed width file.

All, I used to use following command to replace specific location in a fixed width file. Recently looks like my command stopped working as intended. We are on AIX unix. awk 'function repl(s,f,t,v) { return substr(s,1,f-1) sprintf("%-*s", t-f+1, v) substr(s,t+1) } NR<=10 {... (3 Replies)
Discussion started by: pinnacle
3 Replies

10. Shell Programming and Scripting

awk issue splitting a fixed-width file containing line feed in data

Hi Forum. I have the following script that splits a large fixed-width file into smaller multiple fixed-width files based on input segment type. The main command in the script is: awk -v search_col_pos=$search_col_pos -v search_str_len=$search_str_len -v segment_type="$segment_type"... (8 Replies)
Discussion started by: pchang
8 Replies
mailq(1)							   User Commands							  mailq(1)

NAME
mailq - print the mail queue SYNOPSIS
/usr/bin/mailq [-Ac] [-q subarg] [-v] DESCRIPTION
The mailq utility displays a summary of the mail messages queued for future delivery. The first line displayed for each mail message shows the internal identifier used on this host for the message, the size of the message in bytes, the date and time the message was accepted into the queue, and the envelope sender of the message. The second line of the display shows the error message that caused this message to be retained in the queue. This line will not be displayed if the message is being pro- cessed for the first time. The mailq utility used to be identical to sendmail -bp. Now it checks for the authorization attribute, solaris.mail.mailq. If the check for the invoking user succeeds, sendmail -bp is executed with the remaining argument vector. Otherwise, an error message is printed. This authorization attribute is by default enabled for all users. It can be disabled by modifying the Basic Solaris User entry in prof_attr(4). OPTIONS
The following options are supported: -Ac Like sendmail(1M), this flag tells mailq to use submit.cf rather than sendmail.cf even if the operation mode does not indicate an initial mail submission. This will result in the client queue /var/spool/clientmqueue being displayed rather than the default server queue /var/spool/mqueue. -qp[time] Similar to -qtime, except that instead of periodically forking a child to process the queue, sendmail forks a single per- sistent child for each queue that alternates between processing the queue and sleeping. The sleep time is given as the argument. The sleep time default is 1 second. The process will always sleep at least 5 seconds if the queue was empty in the previous queue run. -qf Processes saved messages in the queue once and does not fork(), but runs in the foreground. -qG name Processes jobs in the queue group called name only. -q[!]I substr Limits processed jobs to those containing substr as a substring of the queue id, or not when ! is specified. -q[!]R substr Limits processed jobs to those containing substr as a substring of one of the recipients, or not when ! is specified. -q[!]S substr Limits processed jobs to those containing substr as a substring of the sender, or not when ! is specified. -v Prints verbose information. This adds the priority of the message and a single character indicator (+ or blank) indicating whether a warning message has been sent on the first line of the message. Additionally, extra lines may be intermixed with the recipients that indicate the "controlling user" information. This shows who will own any programs that are executed on behalf of this message and the name of the alias this command is expanded from, if any. EXIT STATUS
0 Successful completion. >0 An error occurred. FILES
/etc/security/prof_attr local source for execution profile attributes /var/spool/mqueue default server queue /var/spool/clientmqueue client queue ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsndmu | +-----------------------------+-----------------------------+ SEE ALSO
sendmail(1M), prof_attr(4), attributes(5) SunOS 5.10 10 Jul 2002 mailq(1)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy