Search Results

Search: Posts Made By: bonosungho
6,044
Posted By bonosungho
what if my file contains hi asdf z z ...
what if my file contains

hi
asdf
z
z
hi
hi
hi

and i want it to be ( the substitution of the second occurrence not the second line)

hi
asdf
z
z
hello
hi
hi
6,044
Posted By bonosungho
vi editor substitution
Hi everyone,

I am new to linux and practicing using vim editor.
I am trying to substitute a word hi to hello

and i can do this using by the following command
s/hi/hello

but this will...
3,845
Posted By bonosungho
never mind I found one
never mind I found one
3,845
Posted By bonosungho
C scripting file reader fgetc()
$ cat test
a b c d e
f g h i j
k l m n



FILE *p;
p = fopen("a.text","r")
int a;
while ( (a = fgetc(p)) != EOF ) {
printf ("current character is %c \n",a);
}


the code above...
36,783
Posted By bonosungho
PERL, push to hash of array problem
$key = "a";
$value = "hello";
%myhash = {} ;
push @{ myHash{$key} }, $hello;

print $myHash{$key}[0]."\n";


this script prints
"hello" but has following error message.


Reference...
2,268
Posted By bonosungho
Never Mind. I solved it Thanks
Never Mind.
I solved it Thanks
2,268
Posted By bonosungho
Comparing String with Number variables
I have two variables and want to perform some functions after comparison


$cat file1
14.abcde

a=`cut -f 1 -d "." file1
b=15

if [ $a -lt $b ]
then
....
fi


but i got an...
13,815
Posted By bonosungho
I am using if statement and I fixed it to if...
I am using if statement and I fixed it to

if [ `echo $line | cut -f 2 -d","`=="" ]
then
echo ""
else
echo $line
fi


but I get an error message below
[: ==: unary operator...
13,815
Posted By bonosungho
bash shell script string comparison
I want to remove a line that has empty string at second field when I use cut with delimeter , like below

$cat demo
hello, mum
hello,

#!/bin/sh

while read line
do
if [ `cut -f 2 -d ","...
2,593
Posted By bonosungho
thanks everyone !! all solved !!!
thanks everyone !! all solved !!!
2,470
Posted By bonosungho
Assigning value to a variable
can we make a global variable and store character values and add other values to that variable ?? for example

a="hello, John"

and can we add value ". How are you? so
a can have

"hello,...
2,593
Posted By bonosungho
abcd="hello world" echo $abcd thanks for...
abcd="hello world"
echo $abcd

thanks for your help!! but!!
I removed all the white spaces but i still got error message

for this command i got an error message
abcd: command not found.
2,593
Posted By bonosungho
bash shell scripting error need help urgently
#! /bin/sh
abcd = "Hello world"

if [ `grep "$abcd" file1` -gt 0]
then
echo $abcd
fi




i got error message that
line3 : abcd: command not found
line5 : [0: command not found...
31,202
Posted By bonosungho
Thanks those join and awk function helps me a...
Thanks those join and awk function helps me a lot.

Just curious, what happens if file1 has


# comment
a, Kevin
b, Vin
c, Sam


what I am trying to do now is using tr to remove ',' and...
31,202
Posted By bonosungho
$ cat file1 file2 file3 | sed '/^#/d' a Kevin ...
$ cat file1 file2 file3 | sed '/^#/d'
a Kevin
b Vin
c Sam
a 10
b 20
c 40
a blue
b yellow
c red
$
$


like your code outputs, the output is


a Kevin
b Vin
c Sam
31,202
Posted By bonosungho
shell script to join multiple files
I am a new to Linux and try to write a script to join three multiple files.

For example, there are three files

file1
# comment
a Kevin
b Vin
c Sam

file 2
# comment
a 10
b 20
c 40...
Showing results 1 to 16 of 16

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