Search Results

Search: Posts Made By: npatwardhan
2,146
Posted By npatwardhan
Taking key values from one file and extracting values from another file
Hi,

I have two files with values in both.

File1:
cat 2 3
dog 4 5
elephant 6 7
camel 2 3
File2:
----+--gkf;ajf=
---+----
+----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9...
Forum: Programming 02-22-2017
1,118
Posted By npatwardhan
Thanks! That worked. What if I want the same...
Thanks! That worked.

What if I want the same for multiple occurrences in the file? Can I put it in a loop?

The pattern to search is aaa1, aaa2, aaa3, etc.

Input file:

lkshfoishfsaf aaa1...
Forum: Programming 02-21-2017
1,118
Posted By npatwardhan
Hi RudiC, Thanks for the feedback. This is...
Hi RudiC,

Thanks for the feedback. This is the sample input and output.

INPUT:
lkshfoishfsaf aaa oiuagfakjfoia lahofihapofd

jaodadoh poaihdaihdpaoihd iohhadaihd
adkhlksahdlsakd aaa...
Forum: Programming 02-21-2017
1,118
Posted By npatwardhan
awk help
Hi All,

I was looking for a quick AWK/SED one liner that will return me the following:


Search for a pattern.
After fourth occurrence of the pattern in the file, the value is on the 7th...
7,319
Posted By npatwardhan
How to remove all words starting from a matching word in a line
Hi Guys,

I have a file like this:



wwwe 1 ioie ewew yyy uuu 88
erehrlk 4 ihoiwhe lkjhassad lkhsad yyy mmm 45
jhash lhasdhs lkhsdkjsn ouiyrshroi oihoihswodnw oiyhewe yyy ggg 77


...
19,513
Posted By npatwardhan
Cannot get to convert multiple spaces to one space
Hi Guys,

I am using a Redhat Linux Centos machine and trying to convert multiple spaces in a file to one space. I am using:


sed '/./,/^$/!d' input_file > output_file


I also tried
...
6,113
Posted By npatwardhan
Thanks, that worked too.
Thanks, that worked too.
6,113
Posted By npatwardhan
Ok I found out what was happening. The original...
Ok I found out what was happening. The original text file had a (space) on every blank line that was messing up the order. I removed the spaces and it worked just fine.

Thanks.
6,113
Posted By npatwardhan
I got the attached file. The empty fields...
I got the attached file.

The empty fields is not the problem. The one column which has the empty fields is the last column. That's the problem. That last column should be the third one.

Can...
6,113
Posted By npatwardhan
Ok can you try the attached file and send me the...
Ok can you try the attached file and send me the output file?

The delimiter is 53. The third group of data does not have all 53 points.

When I try this file, the third group appears in the...
6,113
Posted By npatwardhan
Converting line output to column based output
Hi Guys,

I am trying to convert a file which has a row based output to a column based output. My original file looks like this:


1
2
3
4
5
6
1
2
3



1
2
3
3,528
Posted By npatwardhan
Extract data from records that match pattern
Hi Guys,

I have a file as follows:


a b c 1 2 3 4
pp gg gh hh 1 2 fm 3 4
g h i j k l m 1 2 3 4
d e f g h j i k l 1 2 3 f 3 4
r t y u i o p d p re 1 2 3 f 4

t y w e q w r a s p...
17,318
Posted By npatwardhan
Thanks, methyl and Geekasauras. @methyl, I...
Thanks, methyl and Geekasauras.

@methyl,
I did not save the error message and do not have the PC here so I will copy the error message next time I try it on the PC and post it.

@Geekasaurus,...
5,001
Posted By npatwardhan
Any trick to speed up script?
Hi Guys,

I have a script that I am using to convert some text files to xls files. I create multiple temp. files in the process of conversion. Other than reducing the temp. files, are there any...
17,318
Posted By npatwardhan
cp command not working
Hi Guys,

I have about 12000 files in a folder and I want to copy these to another folder. I am using the cp command to do this but it errors out saying cp -- argument list too long.

Is there...
14,752
Posted By npatwardhan
Can't remove blank lines from a file
Hi Guys,

I have been trying to remove blank lines from a file with no success. I tried using all the following options on the file:



tr -s '\n' < abc.txt

grep -v "^$" abc.txt

sed...
11,669
Posted By npatwardhan
How to execute script on files in another directory?
Hi Guys,

Is there any way I can execute my bash script on files in a different folder than what the script is in? Here is an excerpt of my script:



#!/usr/bin/bash...
4,228
Posted By npatwardhan
Yes, I do. It is removing the files, I just...
Yes, I do.

It is removing the files, I just want to get rid of the error output to the terminal.
4,228
Posted By npatwardhan
How to get rid of cannot remove file error in bash script?
Hi Guys,

I am creating a couple of temp. files in a script. After completing the script, I am using the rm command to delete these files. The files are getting deleted but I am getting "filename -...
5,637
Posted By npatwardhan
Thanks, it's not homework. It's part of a bigger...
Thanks, it's not homework. It's part of a bigger program.
5,637
Posted By npatwardhan
How can I print array elements as different columns in bash?
Hi Guys,

I have an array which has numbers including blanks as follows:


1
26
66
4.77
-0.58
88
99

11
12
333



I want to print a group of three elements as a different...
7,459
Posted By npatwardhan
Thanks guys. Can I use cut and paste? ...
Thanks guys.

Can I use cut and paste?

For example can I cut the values for the second set of a,b,c,d numbers and paste them in the second column, the third set of a,b,c,d numbers and paste...
7,459
Posted By npatwardhan
Convert row data to column data
Hi Guys,

I have a file as follows:


a 1
b 786
c 90709
d 99
a 9875
b 989
c 887
d 111


I want:


a 1 9875
b 786 989
23,822
Posted By npatwardhan
Ok thanks that worked.
Ok thanks that worked.
23,822
Posted By npatwardhan
Thanks, Scritinizer. I forgot to mention, the...
Thanks, Scritinizer. I forgot to mention, the original file also has blank lines in it which I want to store in the array as well. How can I modify the script so that I can store the blank values in...
Showing results 1 to 25 of 183

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