I have a data file e.g. DATA31082009. This file consists of several data files appended to that file. The size of each data file is different. The first line of each file starts with "44". I want to grep data from "44" to the preceding line of next "44" and save it as a individual file. Thus I want to divide the main DATA31082009 into multiple files giving multiple names.
I am new to unix and shell scripting and highly grateful if anybody help me.
This is one sample file consists 8 records and called an individual file. Other files may have much more or less records. For every file the differentiator is "44" at the beginning.
I have used
to obtain no. of files in the combined file.
With the help of your forum, I could come upto this. From now on I am not progressing.
I need to grep each file startiang with 44 and ending with preceding line of next file which starts again with 44. The name of the file should be 3-9 (number in "44" line followed by 126-133 (date in "44" field.
Sorry for lengthy reply - question.
---------- Post updated at 08:21 PM ---------- Previous update was at 08:21 PM ----------
This is one sample file consists 8 records and called an individual file. Other files may have much more or less records. For every file the differentiator is "44" at the beginning.
I have used
to obtain no. of files in the combined file.
With the help of your forum, I could come upto this. From now on I am not progressing.
I need to grep each file startiang with 44 and ending with preceding line of next file which starts again with 44. The name of the file should be 3-9 (number in "44" line followed by 126-133 (date in "44" field.
Sorry for lengthy reply - question.
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Hi, all
I have a csv file that I would like to remove duplicate lines based on 1st field and sort them by the 1st field. If there are more than 1 line which is same on the 1st field, I want to keep the first line of them and remove the rest. I think I have to use uniq or something, but I still... (8 Replies)
I would like to use grep to select multiple lines from a text file using a single-column text file. Basically I want to only select lines from the first text file where the second column of the first text file matches the second text file. How do I go about doing that? Thanks! (5 Replies)
I have a text file which has blank lines. I want them to be removed before upload it to DB using SQL *Loader. Below is the command line, i use to remove blank lines.
sed '/^ *$/d' /loc/test.txt
If i use the below command to replace the file after removing the blank lines, it replace the... (6 Replies)
Dears,
i want cut the lines from a log file. Example of the log file as follows..
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMDeliverContrUtil isDeliverSM
FINE:
May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMUtil addSysUpMsgLog
INFO: . The message content... (1 Reply)
Hi,
I have a log file (updates.log), and I want to hunt the file for any errors. Here's an example of the log file:
SQL> update <table1> set <value1> = '*****';
update <table1> set <value1> = '*****'
*
ERROR at line 1:
ORA-00942: table or view does not exist
Elapsed:... (4 Replies)
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Hi,
I would like to ask if there is any method to grep a chuck of lines based on the latest file in a directory.
E.g
Latest file in the directory:
Line 1: 532243
Line 2: 123456
Line 3: 334566
Line 4: 44567545
I wanted to grep all the line after line 2 i.e. Line 3 and line 4 and... (5 Replies)
I have setof files with data and with same fields multiple times in each of the files.
for example:
file 1
name = mary kate
last name = kate
address = 123
street = abc
name = mary mark
last name = mark
address = 456
street = bcd
file 2
name = mary kate
last name = kate... (2 Replies)
I 'm trying to grep 2 fieldds on 2 differnt lines. Like this:
psit > file
egrep -e '(NS|ES)' $file. Not working. If this succeeds then run next cmd else exit. Pls Help
Gundu (13 Replies)