Search Results

Search: Posts Made By: H squared
4,517
Posted By H squared
Thank you. I am aware of using grep in order...
Thank you.

I am aware of using grep in order to achieve the desired result.
However, I wished to try it using sed.

Could you please let me know how this can be done using sed.
4,517
Posted By H squared
Using multiple conditions in sed
Hello Experts,

Sample.txt:

1#Cooker#Philips#NoCostEMI#Available
2#Cooker#Bajaj#NoCostEMI#Available
3#Cooker#Prestige#NoEMI#Available
4#Cooker#PP#NoCostEMI#OutOfStock...
6,459
Posted By H squared
Thanks. I am writing a wrapper script to...
Thanks.

I am writing a wrapper script to call the awk (say driver.awk) script


# Skip the 1st argument as it is the file name
shift
# fetch the argument values, in comma separated form...
6,459
Posted By H squared
Thanks. I shall try and update.
Thanks.
I shall try and update.
6,459
Posted By H squared
Thanks for the quick response. I would...
Thanks for the quick response.

I would mention that the number of arguments calling the script could be more than 2 and the number of fields to be transformed can be more than 2.

The field # 12...
6,459
Posted By H squared
Replace a field in a comma separated file
Hello Experts,

I have a sample comma separated file as having date data in field # 5 and field #8. Field # 4 and 7 (fields before the date field) are indicators:

This is just a sample data, the...
2,586
Posted By H squared
scp without password
Hello experts,

OS : CentOS

Could you please help me with the following scenario :

I wish to use scp command in order to copy a file (say : f1.txt) from server 2 to server 1.

Both servers...
2,410
Posted By H squared
Print count of unique values
Hello experts,

I am converting a number into its binary output as :


read n
echo "obase=2;$n" | bc


I wish to count the maximum continuous occurrences of the digit 1.


...
22,608
Posted By H squared
Printing array elements in reverse
Hello Experts,

I am trying to print an array in reverse.

Input :

1. Number of array elements
2. The array.

Eg:

4
1 2 3 4

Expected Output (elements separated by a space) :

4 3 2...
10,098
Posted By H squared
Select / Print odd-even elements of an array
Hello experts,

I wish to print the contents of odd-even numbered indices of an array.

The problem statement is as follows :

1. The first line contains an integer, (the number of test...
1,763
Posted By H squared
Hello Don and Cero, Thanks for the...
Hello Don and Cero,

Thanks for the pointers.

The issue has been resolved.

Regards,
Haider
1,763
Posted By H squared
Hello Don, Thanks for the quick help. ...
Hello Don,

Thanks for the quick help.

As instructed I have modified my code.

The below mentioned code works fine for the EQUILATERAL and SCALENE cases.
However, it fails for the...
1,763
Posted By H squared
Please elaborate on your requirement. Also,...
Please elaborate on your requirement.
Also, kindly provide the code (if any) which you have written so far
1,763
Posted By H squared
Problem with elif and else
Hello experts,

I am having problems with ELIF.

Please see the below code :



read a;
read b;
read c;
if [ $a = $b ] || [ $b = $c ] || [$c = $a ]; then
echo "EQUILATERAL"
elif [ $a !=...
1,781
Posted By H squared
The output of scenario 1 (dissimilar elements)...
The output of scenario 1 (dissimilar elements) can be redirected to a file as :


{ grep -Fvf 2.txt 1.txt && grep -Fvf 1.txt 2.txt; } > 3.txt


For scenario 2, it is relatively easier...
1,781
Posted By H squared
Thanks for the idea, I tried the following code...
Thanks for the idea, I tried the following code to get the
combined result of dissimilar elements from both files


grep -Fvf 2.txt 1.txt && grep -Fvf 1.txt 2.txt

2
4
6
g
f
x
z
m...
1,781
Posted By H squared
Generate separate files with similar and dissimilar contents
Hello experts,

I have 2 files 1.txt (10,000 lines of text) and 2.txt (7500 lines of text).
Both files have similar as well as dissimilar entries.
Is there a way(s) where i can perform the...
1,444
Posted By H squared
Sequentially rename multiple files
Hello team,

We wish to develop a script as follows :

1. Rename multiple files in the following way:
example
Original file names : test.txt and dummy.txt
New file names : test.$(date...
5,779
Posted By H squared
Hello Now I do not get any attachment in...
Hello

Now I do not get any attachment in the mail.

the code being used is :


mutt -s "Mail subject line" $( printf -- "'-a attachment_name'") < "mail body file" "e-mail id"

Thanks,...
5,779
Posted By H squared
Hello RudiC, Could you please help me with...
Hello RudiC,

Could you please help me with the correct command.

Thanks,
Haider
5,779
Posted By H squared
Mutt command error
Hello there,

I am using "mutt" command to send e-mails.



mutt -s "Mail subject line" $( printf -- '-a attachment_name') < "mail body file" "e-mail id"


I wish to change the name of...
2,631
Posted By H squared
Hello, Thank you for the pointer. I...
Hello,

Thank you for the pointer.

I have tried the following command :



sed -e '/pppp Repository/r file1.html' -e'/qqqq Repository/ r file2.html' final1.html




All 3 files :...
2,631
Posted By H squared
Append file contents of one file into another
Hello there,

I have a files f1.html, f2.html.

I have a final file called final.html which is something like the below snippet


<!DOCTYPE html>
<html>
<body>
<h1 align="center">aaaaa...
2,175
Posted By H squared
Hello, I am trying a different approach...
Hello,

I am trying a different approach now.

I am generating the output as an XML file.


<?xml version="1.0"?>
<ROWSET>
<ROW>
<t1>aaaaa</t1>
<t2>bbbbb</t2>
<t3>ccccccc</t3>
</ROW>...
2,175
Posted By H squared
Hello With the command, i am getting an...
Hello

With the command, i am getting an output for a few entries as :

abc, xyz;2;8
pqr;2 3; <---- Incorrect entry
egf, uvw a;4;2

Please help

Thanks,
Haider
Showing results 1 to 25 of 32

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