Search Results

Search: Posts Made By: newageBATMAN
1,927
Posted By newageBATMAN
1. Some of the Input fields are out of Column...
1. Some of the Input fields are out of Column while Copy pasting them in Notepad, Plz ignore them. Data is in Column format.
2. Thanks for the effort & will love to see u sharing them here. May be...
1,927
Posted By newageBATMAN
I have slightly modified the Code to stream line...
I have slightly modified the Code to stream line the tabs for Formatted Output....
awk '/^Event/ {L=1}
!L {next}
/^Event/,/^END/ ...
1,927
Posted By newageBATMAN
1. Tabs or Spaces doesn't matter, ultimately the...
1. Tabs or Spaces doesn't matter, ultimately the output has to go to excel & excel will be able to convert it to Columns on both Tabs/Spaces

2. 2nd Table has around 10 Fields but some fields may...
1,927
Posted By newageBATMAN
awk 'begin{FS="\t";}...
awk 'begin{FS="\t";} /^Event1/,/^END/{i=$1;a[i]=$0} /^Date/,/^END/{if(NR>FNR && NF>2) {printf "%s\t %s\t %s\t %s\t %s\n" ,$1,$2,$3,$4,a[$5]}}' test.txt test.txt

Output

Date Month Year ...
1,927
Posted By newageBATMAN
Line up Print outs from Separate Rows
A text file has two logs of same event & both logs have to be correlated into a single line before same can be processed further

RAW
RunningLog

Date Month Year Time Event
9 ...
21,301
Posted By newageBATMAN
Mention a snap of Raw file as well as expected Op
Didn't get ur Requirement completely, So assuming ur code does your Job,
to avoid special Character, may be u can deploy it as follows:D

awk 'BEGIN {max = 0} {if ($1>max && $1!= ">") max=$1} END...
1,721
Posted By newageBATMAN
Hi All... Is there any possibility of achieving...
Hi All...
Is there any possibility of achieving the same using a Shell Script ..
14,628
Posted By newageBATMAN
awk -F" " '{if($1=="ndc" && $2=="ndc") {print...
awk -F" " '{if($1=="ndc" && $2=="ndc") {print NR"\t"$0}}' inputFile

Change your Column patterns in place of "ndc" ......

Output:
3 ndc ndc 451
5 ndc ndc 100
1,721
Posted By newageBATMAN
Thanks ...Solved
This one worked for me... My final code for others' future reference is as follows

for i in *.*; do awk '/^Event/,/^END/ {i=$1;A[i]=$0;} /^Date/,/^END/ {if(NR>FNR && !/^END/ && NF>4) {printf "%5s...
1,721
Posted By newageBATMAN
Will work for a single file
awk '
/^Event/,/^END/ {
i=$1
sub($1,x)
A[i]=$0
}
/^Date/,/^END/ {
if(NR>FNR && !/^END/) print $0 A[$NF]
}
' file file

Appreciate the logic which simplifies the...
1,721
Posted By newageBATMAN
Lookup Within a file
A text file has two logs of same event & both logs have to be correlated into a single line before same can be processed further

RAW

OPERATING LOG

Date Month Year Time Event
10 ...
901
Posted By newageBATMAN
from ?
Do files remember their Last Directory :confused: .....

It may be possible to note the file Directory inside the file that can be verified by the Script
1,188
Posted By newageBATMAN
awk 'BEGIN{FS=";"}{print $2}' filename hope...
awk 'BEGIN{FS=";"}{print $2}' filename

hope this helps
1,337
Posted By newageBATMAN
awk ' BEGIN{FS=",";LEN=9;FILL=",0.0"} {if(NF<LEN)...
awk ' BEGIN{FS=",";LEN=9;FILL=",0.0"} {if(NF<LEN) {a=NF;{printf "\n%s",$0};for(i=a+1;i<=LEN;i++){printf "%s",FILL}} else {printf "\n%s",$0}} ' filename.txt
Can u plz check whether the above line...
1,337
Posted By newageBATMAN
how many comma Separated values
number of comma separated fields are always 9 or varies :confused:
2,003
Posted By newageBATMAN
Thanks ...Solved
Rudic's code worked, being new to awk, i thought L & O to be some sort of Inbuilt variable carrying some special meaning:D.

Thanks to both Rudic & Corona for Support ...:b:
2,003
Posted By newageBATMAN
Hi Rudic, can u plz explain the Code, i am not...
Hi Rudic,
can u plz explain the Code, i am not able to make out the meaning of L & Os ...:D

BR//
2,003
Posted By newageBATMAN
Single Line output
The Output is a single line output wrapped by Text limit, not readable.

I tried to make it readable by using {printf "%s\n",O}, but no change in Output.
2,003
Posted By newageBATMAN
I have mentioned the Raw data to be processed &...
I have mentioned the Raw data to be processed & the Output too..

Let me know if any other info req ..

BR//
2,003
Posted By newageBATMAN
Parsing Column Values in Row
Hi ,

I have been trying to write a awk script which will have the following Output

1. Append the last Characters of the lines matching pattern xxxxxxxxx & then a space & then Append the last...
3,196
Posted By newageBATMAN
Hi Panyam .... with slight modification of...
Hi Panyam ....

with slight modification of Logic the multi printing issue resolved. final lines looks like following:

awk '/100614/ {a=$0;c=1;b=0;next} /xxxxxxxxx/&&c==2 {b=1;next} /END/...
3,196
Posted By newageBATMAN
5 TImes Print
Sorry for delayed reply, but your one liner worked like a Charm. Output is just the way I wanted.
But for every file data is appearing 5 times & 1st data is correct, but the remaining 4 times are...
3,196
Posted By newageBATMAN
Copy Lines between Keywords & paste them to another file
hi,
I have Multiple files with the following data :

File1

100414 DR1
END
XXXXX
Test1 Test2 Test3
Test4 Test5 Test6
END

100514 DR2
END
XXXXX
Test7 Test8 Test9
Test10 Test11 Test12...
Showing results 1 to 23 of 23

 
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy