Search Results

Search: Posts Made By: Samingla
1,959
Posted By Samingla
Help with Alternative for NR==FNR
Hi,

I have an issue with the below script
nawk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print NF?$0:a[x]"\n";if(/^cn:/) x=$0}' FS="[, ]" in1.txt in2.txt > out1.txt
It is taking too long to get a...
2,632
Posted By Samingla
Hi Don, Thanks for your time. Below is the...
Hi Don,

Thanks for your time. Below is the line of code that does not convert the user password to lower case.
copy { print ($1 == "userPassword::" ? $0 : tolower($0))
I have to use a similar...
2,632
Posted By Samingla
Hi Don, Thanks for the update. I am running...
Hi Don,

Thanks for the update. I am running into a small issue where one line in the file is getting converted to lower case. How can I ignore a line to get converted to a lower case.

File1:...
1,503
Posted By Samingla
Hi Singh, Thanks for the update. I see that...
Hi Singh,

Thanks for the update. I see that the empty line is missing after each section of records.

Thanks,
Sam
1,503
Posted By Samingla
nawk 'BEGIN{FS=OFS="cn="} t=tolower($1); print...
nawk 'BEGIN{FS=OFS="cn="} t=tolower($1); print t,$2}' input.txt
1,503
Posted By Samingla
Convert to lower case based on pattern
Hi Gurus,

I am trying to convert some lines in a file based on the patter.Below is an example. Text after cn= and uid: should be converted to lower case.


Input:
dn:...
2,632
Posted By Samingla
Hi Don, Thanks for the update. How do I...
Hi Don,

Thanks for the update. How do I execute this script? I tried by moving the code to a sh file but it failed.

Regards,
Sam

---------- Post updated at 03:15 AM ---------- Previous...
2,632
Posted By Samingla
Hi Srinishoo, I am getting an empty file...
Hi Srinishoo,

I am getting an empty file when I use the awk that you have provided.

Thanks,
Sam

---------- Post updated at 12:47 AM ---------- Previous update was at 12:45 AM ----------
...
2,632
Posted By Samingla
Copying section of file based on search criteria
Hi Guru's,

I am new to unix scripting. I have a huge file with user details in it(file2) and I have another file with a list of users(file1). Script has to search a user from file1 and get all the...
2,868
Posted By Samingla
Great. Works like a charm. Appreciate your help...
Great. Works like a charm. Appreciate your help Yoda.


Thanks,
Sam
2,868
Posted By Samingla
Yoda, Thanks for the update. I get the...
Yoda,

Thanks for the update. I get the below error when I try to run the awk.
awk: bailing out near line 1.

Thanks,
Sam
2,868
Posted By Samingla
Hi Yoda, Below is the code that I am using...
Hi Yoda,

Below is the code that I am using to delete a section of records from a file if the section has a constant value.
awk '!/(^|\n)xyz: true/' RS='' ORS='\n\n' sample_delete.txt

But now...
2,868
Posted By Samingla
Help with UNIX script --Read from one file and delete entries in other
Hi Guru's

The script has to read an entry from one file and delete the set of lines form other file. Below is the format of the file. In the below example, script should read the entries from...
3,106
Posted By Samingla
Hi DGPickett, It is not wrorking for all the...
Hi DGPickett,
It is not wrorking for all the senarios. The code is working only if the aa value is in email format. I want the value from mail to be substituted after aa="" and leaving...
3,106
Posted By Samingla
Hi scrutinizer, Thanks for the quick...
Hi scrutinizer,

Thanks for the quick response. It is working fine for the sample input. My input file block does not have the same sequence all the time. mail: parameter can be any were in the...
3,106
Posted By Samingla
Help With String Manipulation
Hi Guru's,
I need some help with data manipulation using shell scripting. I know how to replace the whole string but not part of the string.
The value after aa= should be replaced with the value in...
3,538
Posted By Samingla
The code is working fine for some records. I am...
The code is working fine for some records. I am seeing different behavior if I run the same agains huge file. Id values in output file are not in sync with the id values in id list file.

Thanks,...
3,538
Posted By Samingla
Hi Franklin, The code is adding the string but...
Hi Franklin,
The code is adding the string but after records, the code is placing wrong id values. I mean code is adding id value of some other cn. I am working on a 45mb file.

Thanks,
Sam
3,538
Posted By Samingla
Hi Franklin, Along with the id value from...
Hi Franklin,
Along with the id value from id_list file, how can we add a constant string (Example xxx: mno) in attributes file using the same code?

Thanks,
Sam

---------- Post updated at...
3,538
Posted By Samingla
Kota, Thanks for the reply. Yes all cn...
Kota,

Thanks for the reply. Yes all cn values in id_list file are in capitol letters. Mistake from my end. id_list file will be like this.


cn: ABC, id: 111
cn: DEF, id: 222
cn: GHI, id:...
3,538
Posted By Samingla
issue with toupper in nawk
Hi All,

I am seeing an issue while using toupper in nawk. Below is the code that I am using.Toupper method is not working as expected in this case.nawk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print...
2,454
Posted By Samingla
Hi vgersh99, I tried it as from the other...
Hi vgersh99,

I tried it as from the other post. It did not work. Below is the code I am using.

nawk 'NR==FNR{a[$1" "$2]=$4" "$5}NR>FNR{print NF?$0:a[x]"\n";if(/^cn:/) x=toupper($0)}' FS="[,...
2,454
Posted By Samingla
Hi Y, I have tested it and it is not...
Hi Y,

I have tested it and it is not working as expected.

thanks,
Sam
2,454
Posted By Samingla
Where should I use this?
Where should I use this?
2,454
Posted By Samingla
toupper in the awk
Hi Y,

How can I use toupper in the same script. I have a problem with the current script. The CN entry in file2 is always in capitol. The same CN entry in file1 may be in capitol lettors or small...
Showing results 1 to 25 of 40

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