Search Results

Search: Posts Made By: c0384
2,177
Posted By c0384
Replacement of string
Hi

I have a text file which contains the following.

AAA,BBB,CCC,DDD
AAA,BBB,CCC,DDD
AAA,BBB,CCC,DDD

How can I replace all CCC with 888, with other contents inside the file remain unchange?...
9,112
Posted By c0384
sorry about the typo mistake... this time...I...
sorry about the typo mistake...
this time...I would like to concanate the contents of file B with contents of file A, then for the resulted output, I would like overwrite it into file A, as shown...
9,112
Posted By c0384
How to write data in column
I Have Two Files, A And B. How Can I Rewrite Them Into A New File With The Following Pattern?

File A
123
456
789

File B
235
478
987

Become

123 235
456 478
987 789
...
4,349
Posted By c0384
Help with grep command
Hi

May I know how can I use grep command to do the following operation?

Example:

Case1
ABC=1

Hello
How are you?

Case 2
ABC=2

Hello
How do you do

Case 3
ABC=3
12,706
Posted By c0384
after issuing awk ' BEGIN { FS=","} { if (NR...
after issuing
awk ' BEGIN { FS=","} { if (NR == 2) { $2 = 777 ;$1 = 888 } print } ' filename
command, I found that the line that I edited seperator become a blank. How can I set it back to comma?...
20,827
Posted By c0384
I have set to = but for the following error. ...
I have set to = but for the following error.

if: Expression syntax.
20,827
Posted By c0384
if else command syntax error
can anyone tell me what`s going wrong with my if else statement?


set exam=(AAA BBB CCC)

foreach ii ($exam)
if ($ii -eq "AAA")
do
echo "PASS"
else
echo "FAILED"
done
end
12,706
Posted By c0384
i field seperators that I want in line 2 and line...
i field seperators that I want in line 2 and line 3 are different. In this case, I need to define field seperator twice, don`t I?
12,706
Posted By c0384
awk ' { BEGIN { FS=","};if (NR == 2) { $2 = 777...
awk ' { BEGIN { FS=","};if (NR == 2) { $2 = 777 ;$1 = 888 }; BEGIN { FS=" "};if (NR == 3) { $3 = 555 } print } ' filename

may i know whether the above syntax correctly defined the fiels seperator...
12,706
Posted By c0384
may i know how can I specify field seperator as...
may i know how can I specify field seperator as comma? (or other sign like $, . and etc)?
12,706
Posted By c0384
may i know how awk command count the number of...
may i know how awk command count the number of words in a line?
for example
123,134,156 - is it counted as one words only? or 5 words?

If I wish to modify only 123 and 134 to 555 and 333...
12,706
Posted By c0384
Hi may I know whether the following syntax...
Hi

may I know whether the following syntax is correct or not? if not, what should be the correct one?

awk ' { if (NR == 2) { $2 = 777 $1 = 888 } if (NR == 3) { $3 = 555 } print } ' filename
17,323
Posted By c0384
if I have 2 nested foreach loop and I have two...
if I have 2 nested foreach loop and I have two conditions to satisfy in switch case, how should I correct the syntax below to the correct one?

#! /usr/bin/csh

set exam=(AAA BBB CCC)
set...
12,706
Posted By c0384
hi can I use awk command to change word 2 on...
hi

can I use awk command to change word 2 on line 2 and word 3 on line 3 into 777 and 555 respectively (for example)? if yes, how should I write the awk syntax?
17,323
Posted By c0384
help on switch command
hi

can anybody help me with the switch syntax?

set exam(AAA BBB CCC)
foreach ii ($exam)
switch ($ii)
case $ii=="AAA"
echo aaa
breaksw
case $ii=="BBB"
echo bbb
breaksw
case $ii=="CCC"...
12,706
Posted By c0384
Hi Jean-Pierre I thought " and ' are...
Hi Jean-Pierre

I thought " and ' are refering to the same thing in unix. After changing " to ', the problem solved. Sorry for all the trouble.
12,706
Posted By c0384
The error that I got when run awk "NR==3 {print...
The error that I got when run awk "NR==3 {print "200 3000"; next} 1" unit.dat
is as below.

Syntax Error The source line is 1.
The error context is
NR==3 {print >>> 200 <<<
...
3,808
Posted By c0384
hi sorry for my unclear description of the...
hi

sorry for my unclear description of the problem.

I have two input files (fileA.txt and fileB.txt), and would like to write the contents of two input files into a new file(let says...
3,808
Posted By c0384
How to copy data into a single file plus title
Hi

Can anyone help me with the task below?

Example:

The contents in fileA.txt are:
HELLO
HOW DO U DO?

The contents in fileA.txt are:
HI
I AM FINE.

how to combine the data in 2...
12,706
Posted By c0384
Thanks everyone for valuable suggestions. I...
Thanks everyone for valuable suggestions.

I tried both commands suggested by aigles but it doesnt work. I got errors which indicating syntax error if I am not mistaken.
However, Shell Life...
12,706
Posted By c0384
How to rewrite a line in a file
Hi

Can anyone tell me how can rewrite a line in a file by using line number? I tried to use sed by failed to do so.
For example

HELLO
179.390 111.560
HOW TO DO
WHAT TO DO

to become
...
Showing results 1 to 21 of 21

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