10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
2. Shell Programming and Scripting
I have file 1 & file 2 with content mentioned below. I want to get the output as shown in file3.
Requirement:
check the content of column 1 & column 2, if value of column 1 in file1 matches with first column of file2 then remaining columns(2&3) of file2 should get replaced, also if value of... (4 Replies)
Discussion started by: siramitsharma
4 Replies
3. Shell Programming and Scripting
I have two variables,
my $filename = "abc_yyyy_mm_dd.txt";
my $filename1 = " abc_2011_11_07.txt";
I need to perform some operations after checking if $filename has $filename1 in it
i have used the below code,
if($filename =~ /^$filename1/)
{
----
--
} (2 Replies)
Discussion started by: irudayaraj
2 Replies
4. Shell Programming and Scripting
Experts,
I am a beginner to Unix Shell Scripting
We have source as a flat file which contains CTRL+F character as the delimiter. We need to count the number of records in the file (CTRL+F) to perform file validation
Following command being used:
awk '{cnt+=gsub(//,"&")}END {print cnt}'... (4 Replies)
Discussion started by: srivijay81
4 Replies
5. Shell Programming and Scripting
Hi All,
Hope someone can advise here as I have been struggling to find a syntax that works here. I have tried a stack of combination I have seed in the forums but I think because I have needed to use "" and `` in the statments another method is found.
I am reading in lines with the following... (1 Reply)
Discussion started by: nkwilliams
1 Replies
6. Shell Programming and Scripting
Hi,
In my shell script i have to match a patten in a file , if found i have to prefix the entair line by a "word"
eg. pattern = "aaa" prefix= #123
file: bbbb xxx
zzzz aaaa
qqqq kkkk
outPut file: bbbb xxx
... (5 Replies)
Discussion started by: shivarajM
5 Replies
7. UNIX for Dummies Questions & Answers
Hello,
Despite reading the Pattern Matching chapter in the O'Reilly Sed & Awk book several times and
looking at numerous examples, I cannot seem to get any kind of conditional script to work in my awk scripts!
I am able to do the basic awk and grep script to capture the data but when I do with... (0 Replies)
Discussion started by: pg55
0 Replies
8. Shell Programming and Scripting
For whatever reason I cant seem to fix my syntax to do the following. I want to run a grep and count how many instances come up and store that number in a variable but I keep erroring out. Here's my code in bash:
number=grep blah file.txt | wc -l (1 Reply)
Discussion started by: eltinator
1 Replies
9. Shell Programming and Scripting
i have this SSH command which runs perfectly on command prompt in sunOS
ssh -o Port=${portno} ${uname}@${server} find ${dir_path} -name '***'
output : /usr/local/home/***
My problem is when i run same command in my script
#!/usr/bin/ksh
res=`ssh -o Port=${portno} ${uname}@${server}... (1 Reply)
Discussion started by: prash184u
1 Replies
10. Shell Programming and Scripting
Hi All,
I'm trying to test a Hash variable but it's not working. Here is my code - can anyone tell me if the test is valid?
for (keys %enabled_yn) {
if ($enabled_yn{$1} =~ m/\s+Y/) {
$html =~ s/%(\w+)%/\<b\>\<font color\=orange\>$enabled_yn{$1}\<\/font\>\<\/b\>/g;
}... (1 Reply)
Discussion started by: pondlife
1 Replies