Search Results

Search: Posts Made By: Amit Joshi
8,231
Posted By Amit Joshi
Thanks RudiC, your solution worked for me and I...
Thanks RudiC, your solution worked for me and I have learnt 2 new function sub & gsub but I simplified it as per below command


echo '"Amit","Amit"' | awk -v COL=2 -v SRCH="Amit" -v REP="XXX"...
8,231
Posted By Amit Joshi
How to search and replace string from nth column from a file?
I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below

# For Comma seperated file without quotes

...
3,190
Posted By Amit Joshi
Thanks Don :) , Solution is working fine but Need...
Thanks Don :) , Solution is working fine but Need clarification for below

IAm=${0##*/} - I have understand that it is something like $0 but here we are removing leading string if it matches with...
3,190
Posted By Amit Joshi
Apologies for this, Will take care in future. ...
Apologies for this, Will take care in future.

Please find the details

Operating System
uname -a
Linux XXXXXXXX 2.6.32-220.25.1.el6.x86_64 #1 SMP Tue Aug 14 13:14:38 EDT 2012 x86_64 x86_64...
3,190
Posted By Amit Joshi
Already given answer of Don Cragun's questions. ...
Already given answer of Don Cragun's questions.

Make it generic means same code should work for any file where as file structure may differ and column number which need to drop may differ.
3,190
Posted By Amit Joshi
I just use cut command or awk to print the...
I just use cut command or awk to print the columns as mentioned by sam05121988 but I just thought of making it generic so that it should work for any file just we need to pass column number which we...
3,190
Posted By Amit Joshi
Thanks sam05121988 for replying. But as I...
Thanks sam05121988 for replying.

But as I mentioned above I need generic solution which can be used for both input file as I can pass any column number to delete from file.

I hope I am...
3,190
Posted By Amit Joshi
Need to remove columns from file at run time
I want to built a generic code to remove columns from file. Column number will be passed at run time.I may have multiple number like 2,5,10 so Can you please help.

I know how to remove when we...
1,866
Posted By Amit Joshi
Other user should not read the file but can execute
Hi,

I have one script for which I want that other user should not read the script file but can execute. Is there any method ?

I tried by giving 711 but it gives Permission denied to other...
12,669
Posted By Amit Joshi
Thanks bakunin for superb explanation :) It...
Thanks bakunin for superb explanation :) It really helped me to understand the each option used in command.

Thanks anbu23 and all for your inputs.It was really helpful.
12,669
Posted By Amit Joshi
Print all lines between two keyword if a specific pattern exist
I have input file as below I need to check for a pattern and if it is there in file then I need to print all the lines below BEGIN and END keyword. Could you please help me how to get this in AIX...
15,270
Posted By Amit Joshi
Please try this sort file1.txt > tmp1 ...
Please try this


sort file1.txt > tmp1
cut -d, -f1 file2.txt | sort | uniq > tmp
diff tmp tmp1 | grep '>' | sed -e 's/> //g' > file3.txt
rm -f tmp1 tmp
Forum: AIX 08-04-2015
5,799
Posted By Amit Joshi
Sort by date field in AIX
I wanted to sort the below data on 4th field(comma seperator) based on month and date and time on AIX OS.

Input data:

3,AJ,30 Jul 06:30,30 Jul 06:30
5,AJ,30 Jul 06:30,30 Jul 06:49
10,AJ,30...
8,853
Posted By Amit Joshi
How to get last 12 month date in YYYY.MM format?
I need the date format in YYYY.MM format and I am able to get current month date as well as previous month date with below command


PM=`date +'%Y.%m' -d 'last month'`
CM=`date +'%Y.%m' -d 'now'`...
2,996
Posted By Amit Joshi
..@..
Thanks vgersh99

It worked fine.

It would be very helpful if you can please explain what [._.] is doing and how it split 4th column into array and value assign to each array ?
2,996
Posted By Amit Joshi
..2..
I have tried below command but it is replacing complete string not specified pattern.
I am not sure how to check for sub string here so please help.


awk -F, '{ OFS="," ; if ($4 ~ /07/)...
2,996
Posted By Amit Joshi
Replace pattern from nth field from a file
I have posted this again as old post is closed and I am not able to reopen. so please consider this new post

Input File :


1,A,Completed,06.02_19.36,Jun 30 20:00
2,BBB,Failed,07.04_05.12,Jul...
1,421
Posted By Amit Joshi
Replace pattern from nth field from a file
$ cat /cygdrive/d/Final2.txt
1,A ,Completed, 07.03_23.01 ,Jun 30 20:00
2,BBB,Pending,,
3,CCCCC,Pending,,
4,DDDDD,Pending,,
5,E,Pending,,
6,FFFF,Pending,,
7,G,Pending,,


In the above file...
Showing results 1 to 18 of 18

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