Sponsored Content
Top Forums Shell Programming and Scripting awk;sed appending line to previous line.... Post 302328201 by walkerwheeler on Tuesday 23rd of June 2009 05:16:57 PM
Old 06-23-2009
Thanks Jim!

I am not quite sure I understand how the second line parses in english but the script works perfectly.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Appending line/lines with sed

Hi folks, I need to append line or bulk of lines into a file. For example,I have the following section in opmn.xml file: <process-type id="OC4J_RTEadmin_NIR" module-id="OC4J"> <module-data> <category id="start-parameters"> <data... (28 Replies)
Discussion started by: nir_s
28 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

Sed - Appending a line with a variable on it

Hi, I searched the forum for this but couldn't find the answer. Basically I have a line of code I want to insert into a file using sed. The line of code is basically something like "address=1.1.1.1" where 1.1.1.1 is an IP Address that will vary depending on what the user enters. I'll just refer... (4 Replies)
Discussion started by: eltinator
4 Replies

4. Shell Programming and Scripting

sed: appending alternate line after previous line

Hi all, I have to append every alternate line after its previous line. For example if my file has following contents line 1: unix is an OS line 2: it is open source line 3: it supports shell programming line 4: we can write shell scripts Required output should be line1: unix is an OS it is... (4 Replies)
Discussion started by: rish_max
4 Replies

5. Shell Programming and Scripting

SED or AWK "append line to the previous line"

Hi, How can I remove the line beak in the following case if the line begin with the special char “;”? TEXT Text;text ;text Text;text;text I want to convert the text to: Text;text;text Text;text;text I have already tried to use... (31 Replies)
Discussion started by: research3
31 Replies

6. Shell Programming and Scripting

Appending string (charachters inside the line) to a fixed width file using awk or sed

Source File: abcdefghijklmnop01qrstuvwxyz abcdefghijklmnop02qrstuvwxyz abcdefghijklmnop03qrstuvwxyz abcdefghijklmnop04qrstuvwxyz abcdefghijklmnop05qrstuvwxyz Whatever characters are in 17-18 on each line of the file, it should be concatenated to the same line at the character number... (6 Replies)
Discussion started by: tamahomekarasu
6 Replies

7. Shell Programming and Scripting

awk get matched line's previous line

hi everyone, a b in c d e f in g output is: a e so awk search for "in", then print out the matched line's previuos line. Please advice. (11 Replies)
Discussion started by: jimmy_y
11 Replies

8. Shell Programming and Scripting

Sed Comparing Parenthesized Values In Previous Line To Current Line

I am trying to delete lines in archived Apache httpd logs Each line has the pattern: <ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL> This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Discussion started by: Proteomist
1 Replies

9. Shell Programming and Scripting

awk script -print line when $2 > $2 of previous line

Hi all, From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30. Input would be like ... AN237 010 193019 0502 1 CSU Amoxycillin AN237 080 ... (2 Replies)
Discussion started by: gafoleyo73
2 Replies

10. UNIX for Beginners Questions & Answers

awk or sed to print the character from the previous line after the regexp match

Hi All, I need to print the characters in the previous line just before the regular expression match Please have a look at the input file as attached I need to match the regular expression ^ with the character of the previous like and also the pin numbers and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
UNSORT(1)						    BSD General Commands Manual 						 UNSORT(1)

NAME
unsort -- reorder lines in a file in semirandom ways SYNOPSIS
unsort [-hvrpncmMsz0l] [--help] [--version] [--random] [--heuristic] [--identity] [--concatenate] [--merge] [--merge-random] [--seed integer] [--zero-terminated] [--null] [--linefeed] [file ...] DESCRIPTION
unsort prints the lines in the input files (or standard input) in semi-random order. Available algorithms are a Mersenne Twister based PRNG and a heuristic algorithm that aims to create a subjective even distribution. Command line options -h, --help Display a concise summary of the available options and argument syntax. -v, --version Display version and copyright information. -r, --random Use the Mersenne Twister based randomization algorithm. -p, --heuristic Use the heuristic "shuffling" algorithm which permutes the lines in such a way that they're spread more or less evenly in the output. This is the default. -n, --identity Do not reorder lines in the input. Useful if you just want to merge the files. -r, --concatenate Concatenate all input files then apply the shuffling algorithm to the result as a whole. -m, --merge Shuffle all input files seperately then merge the result. Equal-sized files will be merged in the order in which they appear on the command line. -M, --merge-random Shuffle all input files seperately then merge the result. Equal-sized files will be merged in random order. This is the default. -s, --seed integer Use this integer as a seed, instead of random data from the environment. -z, --zero-terminated, -0, --null Lines are terminated with a character. -l, --linefeed Lines are terminated with a character. This is the default. SEE ALSO
sort(1) Free Software June 1, 2019 Free Software
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy