Hi,
I need help in transforming a text file. Here is an example of file1.txt:
pos1 TABLE ah_feed 3828 48
pos1 TABLE ah_feed 7402 103
po1 VWW ah_feed 1234 123
po1 VWW ah_feed 1234 123
pos2 TABLE DEPT_XREF 6365942 181866
pos2 TABLE DEPT_XREF 12758867 364521
pos2 VWW dep_f 122 2
pos2 TABLE...
This is my starting point:
awk '{print $5}' stat.txt
This produces:
ID
20:32:18
Statcode
--------
4
4
12
How do I get the values of Statcode (which for this file is 4,4,12 and check them, if I get a 12 or 8, message an error)
I am using a ksh script. Please help me read and get values from this file called stat.txt:
Job information for Job ID '465' using a Traditional view
Job "PD1002_predefined" - 2007-06-21 20:32:18
(ID 465)
Operation: ARCHIVE
TDPID: 1
Streams: 3
Stream Client...
Yes and your solution does that. I was thinking that I can issue another command to take that line away for sed.
Thank you for your solution since it does the requirement in one step.
I have a file stream.txt and I need to disregard the lines STREAM TOTALS and lines after that. But I want to include all lines with ARCHIVING DATABASE and lines after that.
06/15/2007 22:18:51 ARCHIVING DATABASE "BACKUP_CONTROL_DEV"
06/15/2007 22:18:53 TABLE "ARCHIVE_DB" - 438 BYTES, 0 ROWS...
I have a textfile named table1.txt and I want to write the records in one line. If the next line do not have any date before the line or there is a blank, this line should be paste on the first line. I would appreciate any help in solving this problem. I tried to do this, but not working
tr -s...
Thank you for your response. I modified it a little to output to a new file, I used the code inside the KSH script. It works as expected.
awk '
/ARCHIVING DATABASE/ {
db_prefix = "ARCHIVING DATABASE " $5;
print db_prefix;
next;
}
$3 ~ /TABLE/ {
out = db_prefix...
Thank you Jean-Pierre for the quick reply. However, I need to put the code inside a KSH script, this below do not work. I am really new with awk and would like to ask your assistance how to read this tmp.txt file.
#!/usr/bin/ksh
awk '/ARCHIVING DATABASE/ {
db_prefix = "ARCHIVING DATABASE "...
I have a textfile named tmp.txt which contains the following record:
06/13/2007 23:05:23 ARCHIVING DATABASE "table1"
06/13/2007 23:05:28 "table1" - LOCK RELEASED
06/13/2007 23:05:28
06/13/2007 23:05:28 ARCHIVING DATABASE "arctab3"
06/13/2007 23:05:30 TABLE "ARCHIVE_DB" - 438 BYTES, 0 ROWS...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.