Search Results

Search: Posts Made By: ysrini
4,251
Posted By ysrini
Thanks Corona, single quotes did the work !
Thanks Corona, single quotes did the work !
4,251
Posted By ysrini
Su and run single line command
myenv.sh script sets LOG_DIR variable.
I can run the script and echo the variable in a single line as:

# First set LOG_DIR to some dummy 'NONE' value
[ysrini@linuxapp01a ~]$ export...
11,441
Posted By ysrini
Thanks Bakunin, not only did you provide the...
Thanks Bakunin, not only did you provide the answer but a good explanation of understanding the variable expansion. The 'solution' is always more useful than direct 'answer' !
Thanks again...
11,441
Posted By ysrini
ksh - Get last character from string - Bad Substitution error
I want to get the last character from my machine name using the following code, the default shell is bash, the script runs in ksh.
I get 'bad' substitution error on running the script, but works...
13,179
Posted By ysrini
Thanks guys, pgrep/pkill worked too pgrep...
Thanks guys, pgrep/pkill worked too


pgrep -l -U `whoami` -f "java.*tomcat"
pkill -U `whoami` -f "java.*tomcat"
13,179
Posted By ysrini
Ps - list where UID is numeric or name and for current user
Hi,
'ps -ef' returns output of the following format

UID PID PPID C STIME TTY TIME CMD
root 17573 1 0 Sep12 tty6 00:00:00 /sbin/mingetty tty6
hpsmh 18150 14864 ...
1,257
Posted By ysrini
Insert lines above matching line with content from matching
Hi, I have text file:

Name: xyz
Gender: M
Address: "120_B_C; ksilskdj; lsudlfw"
Zip: 20392

Name: KLM
Gender: F
Address: "65_D_F; wnmlsi;lsuod;,...."
Zip:90233I want to insert 2 new lines...
1,951
Posted By ysrini
Hi bipinajith, the search string will not appear...
Hi bipinajith, the search string will not appear in multiple blocks, thanks for thinking about this.

After I posted my question I found solution based on the following link (credit goes to this):...
1,951
Posted By ysrini
Got the solution awk...
Got the solution
awk '/Start/{s=x}{s=s$0"\n"}/121/{p=1}/End/ && p{print s;exit}' <filename>
1,951
Posted By ysrini
Read text between two lines containing a string
Hi,
I have text file like the following:
Start
a
b
121
c
d
End
Start
a
31
e
f
End
Start
p
o
i
k
5,347
Posted By ysrini
Update file record inside read loop
Hi,
I am reading file records inside a while loop,
and want to update the record when certain condition is met.
How can I update a file while being read?
I want to avoid using temporary files,...
5,697
Posted By ysrini
Thanks rdrtx1, i want to store the result of...
Thanks rdrtx1,
i want to store the result of gsub in a variable that i have to further use later within the awk line

When i stored the gsub result in Y, it displays only the first character

$...
5,697
Posted By ysrini
awk gsub
Hi, I want to print the first column with original value and without any double quotes
The output should look like
<original column>|<column without quotes>

$ cat a.txt...
3,955
Posted By ysrini
Thanks bakunin, I was hoping there was a built-in...
Thanks bakunin, I was hoping there was a built-in utility (similar to pstree) that would accomplish my requirement. I will go ahead and write custom code to navigate from current pid to the root
3,955
Posted By ysrini
pstree but without other children of ancestors
Hi, I want to display the process tree of a given PID, however, I don't want to see other children of the ancestors that don't reach the current PID.

My goal is, from the tree result, i have to...
45,947
Posted By ysrini
The files can be zero or non-zero size. "ALL...
The files can be zero or non-zero size.

"ALL i want is a single line command that will print all filenames in the current directory along with the file last line where the file doesn't end with a...
45,947
Posted By ysrini
hi ctsgnb, this c.sh has only one line without...
hi ctsgnb, this c.sh has only one line without having a new line that's why "wc -l" returns zero. c.sh can have multiple lines without having newline at the end of the file, so checking for zero...
45,947
Posted By ysrini
I ftpd files unix to windows. So files in unix...
I ftpd files unix to windows. So files in unix were originally created in windows.
Either way, i want to detect files not ending with a newline
45,947
Posted By ysrini
Hi Ripat, the new command now shows one more...
Hi Ripat,
the new command now shows one more incorrect result too. The result should only display for c.sh

I attached the 3 .sh files here

$ find . -type f -name "*.sh" -exec awk...
45,947
Posted By ysrini
Thanks all, here's what i am trying to do, I am...
Thanks all, here's what i am trying to do, I am close but not there yet
I want to print the last line of script where the file doesn't terminate with a newline.
But checking if the last line is...
45,947
Posted By ysrini
Thanks Subbeh, it works ! Now, how can I print...
Thanks Subbeh, it works !
Now, how can I print the filename and the last line of only those files where the last line is not like '' (empty) ?

In other words, I want list all filenames together...
45,947
Posted By ysrini
Print filename and last line using awk
Hi,
using awk command I want to print filenames and the last line of each file, in a single command line statement.
I want to use 'awk', because I want to add more functionality to this logic...
4,784
Posted By ysrini
Gary, that was exactly what i needed, thank you. ...
Gary, that was exactly what i needed, thank you.

Regarding why i am doing this, when chmod is done the 'c' attribute (ls -ltc) gets updated and i don't want this to be changed for those files that...
4,784
Posted By ysrini
Thanks tukuyomi, i tried and get this error on...
Thanks tukuyomi,
i tried and get this error on hp-ux 11.11 box
cm.sh[3]: stat: not found.
cm.sh[3]: test: Specify a parameter with this command.

We don't have stat,fstat or lstat available !!!...
4,784
Posted By ysrini
chmod 554 * works and on all the files and...
chmod 554 *
works and on all the files and that's not what i want to happen

I am hoping someone could post a one line command to only apply to files in the current directory where the file is not...
Showing results 1 to 25 of 65

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