Sponsored Content
Full Discussion: edit field using sed or awk
Top Forums Shell Programming and Scripting edit field using sed or awk Post 302502896 by zulabc on Wednesday 9th of March 2011 07:29:11 AM
Old 03-09-2011
how to combine 2 files become 1 file let say I've 2 input file#1 and file#2
file#1 file#2
aaaaa eeeee
bbbbb ffffffff
ccccc ggggg
ddddd hhhhh

and the output file become file#3
file#3
aaaaa eeeee
bbbbb ffffffff
ccccc ggggg
ddddd hhhhh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed / awk - inplace or inline edit

I need to remove the '&' from a file. In each line of the file, the fields are separated by ^K. I only want to remove '&' if it exists in field number 9. (example of field 9: abc&xyz) I need to do an in place/in line edit. So far I have accomplished the following: awk -F '^K' '{print... (6 Replies)
Discussion started by: hemangjani
6 Replies

2. UNIX for Dummies Questions & Answers

Adding a new field using sed or awk?

I have a bcp file that contains 10 fields. These fields are separated by a tab. How can I add my name as a new field in the 8th position for every record? I've been playing w/ sed and awk but can't seem to figure this out. (3 Replies)
Discussion started by: sasabune
3 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

File edit with awk or sed

I have the follwoing file: This looks to be : seperated. For the first field i want only the file name without ".txt" and also i want to remove "+" sign if the second field starts with "+" sign. Input file: Output file: Appreciate your help (9 Replies)
Discussion started by: pinnacle
9 Replies

5. Linux

awk/sed for splitting a field into two

I have a tab delimitted dataset with 4 fields. I like to split the second field into two, and have 5 fields. I like to remove the "-" sign when I get a new fiel. would you help? It is like: 1223 100-5 rr dd I need it like: 1223 100 5 rr dd (2 Replies)
Discussion started by: sire
2 Replies

6. Shell Programming and Scripting

Conditional edit for a field using sed

Hi I want to repalce a field in a txt file on solaris with say 100 records and each record having a total of 10 fields separated by a ~ . based on the following condition the record should be edited or else the record should be written as it is to a if the seventh field is 'XX' and if... (2 Replies)
Discussion started by: acharania2011
2 Replies

7. Shell Programming and Scripting

Sed or Awk or both to edit file

What is an efficient way to remove all lines from the input file which contain a file name? inputfile: ======================= # comment # comment # comment 5 8 10 /tmp 5 8 10 /var/run 5 8 10 /etc/vfstab 5 8 9 /var/tmp 5 8 10 /var/adm/messages... (7 Replies)
Discussion started by: Arsenalman
7 Replies

8. Shell Programming and Scripting

Inline edit using sed / awk

Hi, I have file with all the lines as following format <namebindings:StringNameSpaceBinding xmi:id="StringNameSpaceBinding" name="ENV_CONFIG_PATH" nameInNameSpace="COMP/HOD/MYSTR/BACKOFFICE/ENV_CONFIG_PATH" stringToBind="test"/> I want to replace (all the lines) value of... (8 Replies)
Discussion started by: shuklaa02
8 Replies

9. Shell Programming and Scripting

Field overwrite using sed or awk

Is there a way to overwrite a specific field (i.e. line 2 field 3 without getting its contents). For example I would like to simply have a compatible Solaris 10 command line that replaces line 2 field 3 with contents of a variable. I would like to use SED or AWK if possible, but other suggestions... (1 Reply)
Discussion started by: thibodc
1 Replies

10. Shell Programming and Scripting

SED/AWK to edit/add field values in a record

Hi Experts, I am new to shell scripting. Need some help in doing one task given by the customer. The sample record in a file is as follows: 3538,,,,,,ID,ID1,,,,,,,,,,, It needs to be the following: 3538,,353800,353800,,,ID,ID1,,,,,COLX,,,,,COLY, And i want to modify this record in... (3 Replies)
Discussion started by: sugarcane
3 Replies
sccsfile(4)                                                        File Formats                                                        sccsfile(4)

NAME
sccsfile - format of an SCCS history file DESCRIPTION
An SCCS file is an ASCII file consisting of six logical parts: checksum Character count used for error detection. delta table Log containing version info and statistics about each delta. usernames Login names and/or group IDs of users who may add deltas. flags Definitions of internal keywords. comments Arbitrary descriptive information about the file. body the Actual text lines intermixed with control lines. Each section is described in detail below. Conventions Throughout an SCCS file there are lines which begin with the ASCII SOH (start of heading) character (octal 001). This character is here- after referred to as the control character, and will be represented as `^A'. If a line described below is not depicted as beginning with the control character, it cannot do so and still be within SCCS file format. Entries of the form ddddd represent a five digit string (a number between 00000 and 99999). Checksum The checksum is the first line of an SCCS file. The form of the line is: ^A hddddd The value of the checksum is the sum of all characters, except those contained in the first line. The ^Ah provides a magic number of (octal) 064001. Delta Table The delta table consists of a variable number of entries of the form: ^As inserted/deleted/unchanged ^Ad type sid yr/mo/da hr:mi:se username serial-number predecessor-sn ^Ai include-list ^Ax exclude-list ^Ag ignored-list ^Am mr-number ... ^Ac comments ... ... ^Ae The first line (^As) contains the number of lines inserted/deleted/unchanged respectively. The second line (^Ad) contains the type of the delta (normal: D and removed: R), the SCCS ID of the delta, the date and time of creation of the delta, the user-name corresponding to the real user ID at the time the delta was created, and the serial numbers of the delta and its predecessor, respectively. The ^Ai, ^Ax, and ^Ag lines contain the serial numbers of deltas included, excluded, and ignored, respectively. These lines do not always appear. The ^Am lines (optional) each contain one MR number associated with the delta. The ^Ac lines contain comments associated with the delta. The ^Ae line ends the delta table entry. User Names The list of user-names and/or numerical group IDs of users who may add deltas to the file, separated by NEWLINE characters. The lines con- taining these login names and/or numerical group IDs are surrounded by the bracketing lines ^Au and ^AU. An empty list allows anyone to make a delta. Flags Flags are keywords that are used internally (see sccs-admin(1) for more information on their use). Each flag line takes the form: ^Af flag optional text The following flags are defined in order of appearance: ^Af t type-of-program Defines the replacement for the %T% ID keyword. ^Af v program-name Controls prompting for MR numbers in addition to comments. If the optional text is present, it defines an MR number validity checking program. ^Af i Indicates that the `No id keywords' message is to generate an error that terminates the SCCS command. Otherwise, the message is treated as a warning only. ^Af b Indicates that the -b option may be used with the SCCS get command to create a branch in the delta tree. ^Af m module-name Defines the first choice for the replacement text of the %M% ID keyword. ^Af f floor Defines the "floor" release, that is, the release below which no deltas may be added. ^Af c ceiling Defines the "ceiling" release, that is, the release above which no deltas may be added. ^Af d default-sid The d flag defines the default SID to be used when none is specified on an SCCS get command. ^Af n The n flag enables the SCCS delta command to insert a "null" delta (a delta that applies no changes) in those releases that are skipped when a delta is made in a new release (for example, when delta 5.1 is made after delta 2.7, releases 3 and 4 are skipped). ^Af j Enables the SCCS get command to allow concurrent edits of the same base SID. ^Af l lock-releases Defines a list of releases that are locked against editing. ^Af q user-defined Defines the replacement for the %Q% ID keyword. ^Af e 0|1 The e flag indicates whether a source file is encoded or not. A 1 indicates that the file is encoded. Source files need to be encoded when they contain control characters, or when they do not end with a NEWLINE. The e flag allows files that contain binary data to be checked in. Comments Arbitrary text surrounded by the bracketing lines ^At and ^AT. The comments section typically will contain a description of the file's pur- pose. Body The body consists of text lines and control lines. Text lines do not begin with the control character, control lines do. There are three kinds of control lines: insert, delete, and end, represented by: ^AI ddddd ^AD ddddd ^AE ddddd respectively. The digit string is the serial number corresponding to the delta for the control line. SEE ALSO
sccs-admin(1), sccs-cdc(1), sccs-comb(1), sccs-delta(1), sccs-get(1), sccs-help(1), sccs-prs(1), sccs-prt(1), sccs-rmdel(1), sccs-sact(1), sccs-sccsdiff(1), sccs-unget(1), sccs-val(1), sccs(1), what(1) SunOS 5.10 30 Sep 2002 sccsfile(4)
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy