Search Results

Search: Posts Made By: ailnilanjan
1,607
Posted By ailnilanjan
Hello Rudic I am sorry if I was not clear...
Hello Rudic

I am sorry if I was not clear enough..:o

Problem I am facing here, Using the script I am not able to switch user to root in the remote Linux machine due to the error

su: must be...
1,607
Posted By ailnilanjan
Switch user terminal error
Hello All,

Here I am trying to login a Linux machine as admin user from a Solaris box..

& then switch to root user..

Code I use:

ssh admin@<IP> << END
su - root << A
echo "Hello I am...
2,750
Posted By ailnilanjan
Thanks.. That Idea helped!.. :b::b:
Thanks.. That Idea helped!.. :b::b:
2,750
Posted By ailnilanjan
dont have -s to convert to epoc.. many...
dont have -s to convert to epoc.. many restrictions!:o
2,750
Posted By ailnilanjan
Timestamp conversion
Hello All,

I have a file with many timestamps as in below format & example:

20150130105120

2015-> Year in YYYY
01-> Month in MM
30-> Day in DD
10-> Hour in HH
51-> Minute in mm
20->...
728
Posted By ailnilanjan
Matching first 2 columns..
Hello All,

I want to make a file which will have primarily lines of file2 but when first 2 fields matches with the file1 it should have those lines of file1..

example is as below..

file1...
1,771
Posted By ailnilanjan
Now I run this (Note: I changed TRE to tre).. ...
Now I run this (Note: I changed TRE to tre)..

/usr/xpg4/bin/awk 'NR==FNR {sub (/RSL /, "", $28)
T[$12]=$28
next
...
1,771
Posted By ailnilanjan
Thanks AWK worked :D Thanks RudiC.. Seems I...
Thanks AWK worked :D

Thanks RudiC.. Seems I need to remember this..:o

But I am afraid why it returns nothing while I know atleast a case exists as below:confused::

File1 contains below...
1,771
Posted By ailnilanjan
Getting below errors: awk: syntax error near...
Getting below errors:

awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 5
awk: bailing out near line 5



6116

6117
1,771
Posted By ailnilanjan
Thanks Skrynesaver.. I have other part of...
Thanks Skrynesaver..


I have other part of the main script which is written in a shell script.. Actually this is a part of a big shell script..:o

Can you please help me doing this job in bash...
1,771
Posted By ailnilanjan
It is ";" Sorry I should mentioned it...
It is ";"

Sorry I should mentioned it already..:(
1,771
Posted By ailnilanjan
How to match the below conditions?
Hello All,

I have 2 files with around 2k records.. I am lost how to build a script to create another file with the below:confused::eek:

Match Condition1:
File1's 12th Columns data should exact...
1,480
Posted By ailnilanjan
Thanks Don, RudiC.. Both worked well..:b::b::b: ...
Thanks Don, RudiC.. Both worked well..:b::b::b:


I have fixed the mistakes I was making at my end related to file names..:(
1,480
Posted By ailnilanjan
No success.. :( With /usr/xpg6/bin/awk: ...
No success.. :(

With /usr/xpg6/bin/awk:

input file "file[12]"

With /usr/xpg6/bin/awk
line 11: /usr/xpg6/bin/awk: No such file or directory

With nawk
nawk: can't open file file[12]
...
1,480
Posted By ailnilanjan
Replacing first field of file2 with the second filed of file1 for matching cases
Dear All,

Need your help..:D

I am not regular on shell scripts..:(

I have 2 files..


Content of file1

cellRef 4};"4038_2_MTNL_KALAMBOLI"
cellRef 1020};"4112_3_RAINBOW_BLDG"
...
2,264
Posted By ailnilanjan
i had problem with sort so i used hanson44's...
i had problem with sort so i used hanson44's code..

It ran perfectly..

awk '{cnts[$1]++} $2 > fld2[$1] {fld2[$1]=$2; fld0[$1]=$0} END {for (key in cnts) { if (cnts[key] >= 3) print fld0[key]...
2,264
Posted By ailnilanjan
Showing the usage usage: sort [-cmu] [-o...
Showing the usage

usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
[-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...
2,264
Posted By ailnilanjan
I ran the command using input.txt content as X 9 ...
I ran the command using input.txt content as X 9
B 5
A 1
Z 9
T 4
C 9
A 4
C 3
B 2
T 7
C 10
A 5
B 1
X 8

Ouput becameA 5
B 5
C 10
T 7
X 9
2,264
Posted By ailnilanjan
Printing uniq first field with the the highest second field
Hi All,


I am searching for a script which will produce an output file with the uniq first field with the second field having highest value among all the duplicates..

The output file will...
16,656
Posted By ailnilanjan
tac not found in my box man tac No manual...
tac not found in my box

man tac
No manual entry for tac.


Below one worked perfectly & really smart way indeed :) :

printf '%s\n' 1,-500d w q | ed -s file 2>/dev/null
16,656
Posted By ailnilanjan
Thanks all.. I see many responses!! .. :) ...
Thanks all..

I see many responses!! .. :)

I will try them one by one will respond by the end of the day..

Thank you all again...
16,656
Posted By ailnilanjan
My purpose is to delete the lines except the last...
My purpose is to delete the lines except the last few..

For viewing the certain last few I would have used smaller one:

tail -3 t
16,656
Posted By ailnilanjan
tail is not deleting.. various use of tail is...
tail is not deleting.. various use of tail is just displaying..

awk '(s-NR)<500' s=$(cat file | wc -l) file

is returning

"awk: can't open 664"

664 is actually the line number..
16,656
Posted By ailnilanjan
Deleting all lines except last 500
Hi All,

I want to write a script which first check the line counts of a file if its more than 500 it deletes rest except the last 500..

I tried sed but it looks sed counts line numbers from the...
3,337
Posted By ailnilanjan
Many thanks Vidyadhar & Yoda for your help... ...
Many thanks Vidyadhar & Yoda for your help...

I tried Yoda's code as it looked smaller & worked perfectly..

Now I need one more help.. It definitely should be another thread..
Showing results 1 to 25 of 48

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