Search Results

Search: Posts Made By: chatwithsaurav
11,333
Posted By chatwithsaurav
Thanks Jim. Actually I want to use the last...
Thanks Jim. Actually I want to use the last record number in a for loop within awk command.

Ex :
awk'{for(i=1;i<=NR;i++) <action> }'abc.txt

Actually am assuming that the loop is running from...
11,333
Posted By chatwithsaurav
Capture the last record number using "awk" NR variable
Hi Team. I am trying to capture the last record number from a file using the below command ( assuming abc.txt has 21 records and I want 21 as output )
awk'{c=NR;print c}'abc.txt

But it is...
1,153
Posted By chatwithsaurav
Using "for" loop within "awk"
Hi Team. I am trying to execute a simple for loop within an awk but its giving a different result. Below is the main code:

awk '{for(i=1;i<=6;i++) print $i}'The result should be 1 2 3 4 5 6 but...
1,666
Posted By chatwithsaurav
Hi CarloM/RudiC Thanks for your correction....
Hi CarloM/RudiC

Thanks for your correction. The command is working now :)
1,666
Posted By chatwithsaurav
Nope its not. I am using AIX with korn shell.
Nope its not. I am using AIX with korn shell.
1,666
Posted By chatwithsaurav
medpili1: awk -F"|" -vCOMP'20150430' '$4 != COMP...
medpili1: awk -F"|" -vCOMP'20150430' '$4 != COMP {print $0 ": Date Mismatch!"}' file.txt
Usage: awk [-u] [-F Character][-v Assignment][-f File|Commands][Assignment|File] ...

Note that if you...
1,666
Posted By chatwithsaurav
Hi RudiC awk "usage" is not working....
Hi RudiC

awk "usage" is not working. Erroring out
1,666
Posted By chatwithsaurav
Hi RudiC Thanks for your feedback. Well I...
Hi RudiC

Thanks for your feedback. Well I actually need to compare the last date of each month with each of the rows of file1.txt
Example :

cat file1.txt
20150430
20150430
20150430...
1,666
Posted By chatwithsaurav
Code to compare date
Hi All

I have a text file (file.txt) which has a date in YYYYMMDD format in the fourth column. I need to compare and check if that date matches the last date of each month in the same format for...
2,718
Posted By chatwithsaurav
Hi All Thanks! It Worked :)
Hi All

Thanks! It Worked :)
2,718
Posted By chatwithsaurav
Script to check for a specific number of columns in a file
Hi All

I have a file which has five columns in each rows.

cat file.txt
a|b|c|d|e
1|2|3|4|5
a1|a2|a3|a4|a5
.
.
.
I need to make sure that there are no less than five or more than five...
2,112
Posted By chatwithsaurav
Hi The last code worked. :) Thanks to...
Hi

The last code worked. :)

Thanks to everyone
2,112
Posted By chatwithsaurav
Hi All Thanks for all your feedback but the...
Hi All

Thanks for all your feedback but the challenge is I am unable to print the correct row(s) as the scripts which you all have shared is either printing no rows or only those rows which have a...
2,112
Posted By chatwithsaurav
Hi Sam Thanks for your input but...
Hi Sam

Thanks for your input but unfortunately the script is printing all the rows.
2,112
Posted By chatwithsaurav
Script to find blank records in a file except for few columns
I have a file with the following format:
X|High|2|GIC|DM||XHM|||6 Months
X|Moderate|2|GIC|DM||XHM|||6 Months
X|High|2|GCM|DM||XSF|||6 Months
X|Med|2|GCM|DM||XSF|||6

Here there are ten...
6,083
Posted By chatwithsaurav
Hi Rudi Thanks!:) Actually I have...
Hi Rudi

Thanks!:)

Actually I have trying this now :

a=`grep -c " " abc.txt`
if [ $a gt 0 ]
then
{perform rest of code}
fi

But I need to get a better syntax where a simple...
6,083
Posted By chatwithsaurav
Hi Don.. Apologies for not "specifying"...
Hi Don..

Apologies for not "specifying" correctly. :(

1>Well Blank Line would mean spaces and tabs only.
2>Blank records in between "|" delimiter means that the column is NULL (blank as of...
6,083
Posted By chatwithsaurav
To check Blank Lines, Blank Records and Junk Characters in a File
Hi All

Need Help

I have a file with the below format (ABC.TXT) :

®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999...
1,907
Posted By chatwithsaurav
Hi Murphy Well the thing is that I need to...
Hi Murphy

Well the thing is that I need to "rename" two files in the correct format.
The correct format are : "advext_OK_0315_mem_rule_firings.txt" and "advext_OK_0315_rule_thirdparty.txt"
Now...
1,907
Posted By chatwithsaurav
Thanks Rudi... Hi Don Can you please...
Thanks Rudi...

Hi Don

Can you please throw some more light on the code which u shared. Its working but removing all the rest of the files. Can the "*" in the for loop be replaced with anything...
1,907
Posted By chatwithsaurav
Hi RudiC Like every word in the string needs...
Hi RudiC

Like every word in the string needs to be validated?
1,907
Posted By chatwithsaurav
Hi Don Thanks for your solution. Well...
Hi Don

Thanks for your solution. Well normally the user who puts the file in a predefined directory makes spellings mistakes as close to the examples which I have shared. Assuming that the "file...
1,907
Posted By chatwithsaurav
Hi RudiC Many corrupt elements can occur but...
Hi RudiC

Many corrupt elements can occur but the script should automatically correct it to the final name. I actually need that algorithm :)

Regards
Saurabh
1,907
Posted By chatwithsaurav
Automatically correct a File Name
Hi All

Need a help to understand how one can automatically correct a file name using a shell script even if it is in a completely different format...

Ex : adv_OK_0215_mem_rules_firing.txt /...
1,920
Posted By chatwithsaurav
Thanks a Ton Don!.. It worked..
Thanks a Ton Don!.. It worked..
Showing results 1 to 25 of 30

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