Sponsored Content
Top Forums Shell Programming and Scripting Split line before the pattern Post 302247388 by djanu on Wednesday 15th of October 2008 03:14:33 PM
Old 10-15-2008
Split line before the pattern

Hi,

I am trying to use awk to split line before the pattern:

abcde 12345 67890 abcde 12345 67890 abcde 12345 67890 abcde 12345 67890 abcde 12345 67890 abcde 12345 67890 abcde 12345 67890

I need it to be like this:

abcde 12345 67890
abcde 12345 67890
abcde 12345 67890
abcde 12345 67890
abcde 12345 67890

What the easiest way to do it?

Thanks,
DJ
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Split a file with no pattern -- Split, Csplit, Awk

I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this. For example: split -l 3000000 filename.txt This is very slow and it splits the file with 3 million records in each... (10 Replies)
Discussion started by: madhunk
10 Replies

2. Shell Programming and Scripting

Split File Based on Line Number Pattern

Hello all. Sorry, I know this question is similar to many others, but I just can seem to put together exactly what I need. My file is tab delimitted and contains approximately 1 million rows. I would like to send lines 1,4,& 7 to a file. Lines 2, 5, & 8 to a second file. Lines 3, 6, & 9 to... (11 Replies)
Discussion started by: shankster
11 Replies

3. UNIX for Dummies Questions & Answers

find pattern delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: W/D FRM CHK 00 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (1 Reply)
Discussion started by: nickg
1 Replies

4. Shell Programming and Scripting

find pattern, delete line with pattern and line above and line below

I have a file that will sometimes contain a pattern. The pattern is this: FRM CHK 0000 I want to find any lines with this pattern, delete those lines, and also delete the line above and the line below. (4 Replies)
Discussion started by: nickg
4 Replies

5. UNIX for Dummies Questions & Answers

split record without pattern

Hi , I have file with all records in one line, which needs to split it to have a fixed length.Am trying to execute the below script for the same FILENAME="$1" while line LINE do echo $LINE | awk 'BEGIN{n=1}{while(substr($0,n,10)){print substr($0,n,10);n+=10}}' done < $FILENAME it... (4 Replies)
Discussion started by: nishantrk
4 Replies

6. Shell Programming and Scripting

Grep the word from pattern line and update in subsequent lines till next pattern line reached

Hi, I have got the below requirement. please suggest. I have a file like, Processing Item is: /data/ing/cfg2/abc.txt /data/ing/cfg3/bgc.txt Processing Item is: /data/cmd/for2/ght.txt /data/kernal/config.klgt.txt I want to process the above file to get the output file like, ... (5 Replies)
Discussion started by: rbalaj16
5 Replies

7. Shell Programming and Scripting

How to split a file based on pattern line number?

Hi i have requirement like below M <form_name> sdasadasdMklkM D ...... D ..... M form_name> sdasadasdMklkM D ...... D ..... D ...... D ..... M form_name> sdasadasdMklkM D ...... M form_name> sdasadasdMklkM i want split file based on line number by finding... (10 Replies)
Discussion started by: bhaskar v
10 Replies

8. Shell Programming and Scripting

Search for a pattern in a file and split the line into two lines

Hi All, Greetings everyone !!! I have a file which has many lines, out of which one line is as below. I need to search for pattern "varchar(30) Select" and if exists, then split the line as below. I am trying to achieve this in ksh. Can anyone help me on this. (8 Replies)
Discussion started by: Pradhikshan
8 Replies

9. Shell Programming and Scripting

awk to combine lines from line with pattern match to a line that ends in a pattern

I am trying to combine lines with these conditions: 1. First line starts with text of "libname VALUE db2 datasrc" where VALUE can be any text. 2. If condition1 is met then continue to combine lines through a line that ends with a semicolon. 3. Ignore case when matching patterns and remove any... (5 Replies)
Discussion started by: Wes Kem
5 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
MMLS(1) 						      General Commands Manual							   MMLS(1)

NAME
mmls - Display the partition layout of a volume system (partition tables) SYNOPSIS
mmls [-t mmtype ] [-o offset ] [ -i imgtype ] [-b dev_sector_size] [-BrvV] [-aAmM] image [images] DESCRIPTION
mmls displays the layout of the partitions in a volume system, which include partition tables and disk labels. ARGUMENTS
-t mmtype Specify the media management type. Use '-t list' to list the supported types. If not given, autodetection methods are used. -o offset Specify the offset into the image where the volume containing the partition system starts. The relative offset of the partition system will be added to this value. -b dev_sector_size The size, in bytes, of the underlying device sectors. If not given, the value in the image format is used (if it exists) or 512-bytes is assumed. -i imgtype Identify the type of image file, such as raw or split. If not given, autodetection methods are used. -B Include a column with the partition sizes in bytes -r Recurse into DOS partitions and look for other partition tables. This setup frequently occurs when Unix is installed on x86 sys- tems. -v Verbose output of debugging statements to stderr -V Display version -a Show allocated volumes -A Show unallocated volumes -m Show metadata volumes -M Hide metadata volumes image [images] One (or more if split) disk images whose format is given with '-i'. 'mmls' is similar to 'fdisk -lu' in Linux with a few differences. Namely, it will show which sectors are not being used so that those can be searched for hidden data. It also gives the length value so that it can be plugged into 'dd' more easily for extracting the partitions. It also will show BSD disk labels for Free, Open, and NetBSD and will display the output in sectors and not cylinders. Lastly, it works on non-Linux systems. If none of -a, -A, -m, or -M are given then all volume types will be listed. If any of them are given, then only the types specified on the command line will be listed. Allocated volumes are those that are listed in a partition table in the volume system AND can store data. Unallocated volumes are virtu- ally created by mmls to show you which sectors have not been allocated to a volume. The metadata volumes overlap the allocated and unallo- cated volumes and describe where the partition tables and other metadata structures are located. In some volume systems, these structures are in allocated space and in others they are in unallocated space. In some volume systems, their location is explicitly given in the par- tition tables and in others they are not. EXAMPLES
To list the partition table of a Windows system using autodetect: # mmls disk_image.dd To list the contents of a BSD system that starts in sector 12345 of a split image: # mmls -t bsd -o 12345 -i split disk-1.dd disk-2.dd AUTHOR
Brian Carrier <carrier at sleuthkit dot org> MMLS(1)
All times are GMT -4. The time now is 07:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy