Search Results

Search: Posts Made By: machomaddy
1,478
Posted By machomaddy
Script exits when using UNIX2dos / dos2UNIX
I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused:

How do a fix it?


LOG_FILE=MADDY.txt

unix2dos...
5,650
Posted By machomaddy
Get the SUM of TWO columns SEPARATELY by doing GROUP BY on other columns
My File looks like:

"|" -> Field separator

A|B|C|100|1000
D|E|F|1|2
G|H|I|0|7
D|E|F|1|2
A|B|C|10|10000
G|H|I|0|7
A|B|C|1|100
D|E|F|1|2


I need to do a SUM on Col. 5 and Col.6 by...
1,304
Posted By machomaddy
Search and Replace a text if the line contains a pattern
My text file looks like below


.
.
.
abcdefghi
jklmnop

$Bad_ptrq_GTS=rcrd_ip.txt
$Bad_abcd_REJ=rcrd_op.txt

ghijklm
$Bad_abcd_TYHS=rcrd_op.txt
abcgd

abcdefghi
jklmnop
...
12,400
Posted By machomaddy
Help with getting last date of previous month and first date of previous 4th month from current date
I have requirment to get last date of previous month and the first date of previous 4th month:


Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)...
1,792
Posted By machomaddy
Thanks Don!! your explanation was much...
Thanks Don!! your explanation was much appreciated. I realized the fault...I posted the correct code just before your 1st reply :)
You were right, I had few operations to be performed in the second...
1,792
Posted By machomaddy
I tried...Itz nt working. While is not reading...
I tried...Itz nt working. While is not reading the 1st line :confused:. I even created a temp file with Dept names alone and passed it in while loop as below

while read i
do
.
.
.
done <...
1,792
Posted By machomaddy
Help with executing awk and While loop
Hi All,
I have a file say, sample.txt

Source Name: xxx
Department|Revenue
1001|3252
1002|3345


I am using the above file in one of my script. I need to read from Line 3 of the above the...
2,065
Posted By machomaddy
Issue with Connecting to ftp server
Hi All,
I have a ftp link as "ftp://ftp1.xyz.org/abc_ike/". The same thing is opening fine when I use a browser. But I am not sure how to connect to the above link from console. I used the command
...
1,674
Posted By machomaddy
Thanks!!
Thanks!!
1,674
Posted By machomaddy
Unable to read the first space of a record in while loop
I have a loop like

while read i
do
echo "$i"
.
.
.
done < tms.txt


The tms.txt contians data like

2008-02-03 00:00:00
<space>00:00:00
.
.
.
2010-02-03 10:54:32
2,591
Posted By machomaddy
oh ok...I was using the "quick reply" it looked...
oh ok...I was using the "quick reply" it looked like it was editing...but dint realize it was actually bumping the post
2,591
Posted By machomaddy
I dint mean to bump the post. That was totally...
I dint mean to bump the post. That was totally unintentional :)
2,591
Posted By machomaddy
THanks both the codes work. But if number of date...
THanks both the codes work. But if number of date fields increases, the code becomes more lengthy...

---------- Post updated at 09:25 PM ---------- Previous update was at 09:24 PM ----------
...
2,591
Posted By machomaddy
Error passing parameter in "sub" command in awk
I have to replace the pattern found in one file in another file with null/empty "" if found on the fields 3 or 4 ONLY


File 1
====
10604747|Mxdef|9999|9999|9999|2012-03-04 00:00:59...
19,923
Posted By machomaddy
bmk, Thanks. But I was luking for some awk...
bmk,
Thanks. But I was luking for some awk solution :)

Scruntizer,
Could yoy please give a explanation of the code? I tried it but it wasn't wokring in the way I was hoping for.

I test like:...
19,923
Posted By machomaddy
How to Print from nth field to mth fields using awk
Hi,

Is there any short method to print from a particular field till another filed using awk?

Example File:

File1
====
1|2|acv|vbc|......|100|342
2|3|afg|nhj|.......|100|346

...
3,295
Posted By machomaddy
I just wanted to remove the data in file1 which...
I just wanted to remove the data in file1 which matches the pattern in file2. Not the whole line.:o
3,295
Posted By machomaddy
Delete a pattern present in file 2 from file 1 if found in file 1.
I have two files

File1
====
1|2000-00-00|2010-02-02||
2| 00:00:00|2012-02-24||
3|2000-00-00|2011-02-02||

File2
====
2000-00-00
00:00:00


I want the delete the patterns which are...
4,962
Posted By machomaddy
Check if a date field has date or timestamp or date&timestamp
Hi,
In a field, I should receive the date with time stamp in a particular field. But sometimes the vendor sends just the date or the timestamp or correctl the date&timestamp. I have to figure out...
2,416
Posted By machomaddy
Thanks all...SED wrk...Just was wondering if it...
Thanks all...SED wrk...Just was wondering if it was possible using awk's "sub" function...
2,416
Posted By machomaddy
How to use the sub command to replace a <space> between two numbers
Hi I have file which stores dates.


2008-09-12|2008-09-12<space1>00:00:12|<space2>2008-09-12


Some one please help me on how should I use the sub command to replace only the space which has...
10,526
Posted By machomaddy
I just want to do on few fields alone. If othert...
I just want to do on few fields alone. If othert fields have space alone, that wont be a problem...I have to do a search and replace on selective fields alone
10,526
Posted By machomaddy
Find and Replace in multiple fields using awk
Hi,

Say I have a record "1|22| | |". In which the third and fourth fields are <space> alone. I have to replace the <Space> with <null>.

Input:

"1|22| | |" --> "1|22|<space> |<space> |"

...
3,939
Posted By machomaddy
Thanks both the code works fine :). But out of...
Thanks both the code works fine :). But out of curiosity, how to handle if the first column is made of alphabets rather than numerics? In that case all records will become as a single record,...
3,939
Posted By machomaddy
Remove \n <newline> character inside the records.
Hi,
In my file, I have '\n' characters inside a single record. Because of this, a single records appears in many lines and looks like multiple records. In the below file.


File 1
====...
Showing results 1 to 25 of 76

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