Search Results

Search: Posts Made By: palex
1,972
Posted By palex
The awk line works perfectly now. Thank you so...
The awk line works perfectly now. Thank you so much for your help!!!
1,972
Posted By palex
Thanks so much for your help. Here is the output...
Thanks so much for your help. Here is the output I have been getting:

bash-3.2$ awk -F"<[^>]*>" '/b244/ {cn++; if(cn ==2) print $2}; /b203|j151/ {print $2}' hsel*.xml | head
9780323013543...
1,972
Posted By palex
bash-3.2$ echo $SHELL $HOSTTYPE /bin/bash x86_64
bash-3.2$ echo $SHELL $HOSTTYPE
/bin/bash x86_64
1,972
Posted By palex
The revised awk code now gives a line break after...
The revised awk code now gives a line break after each field, instead of after each line. The sed code is giving a blank output file.
1,972
Posted By palex
My apologies, I was referring to the previous...
My apologies, I was referring to the previous solution:

awk -F"<[^>]*>" '/b244/ {cn++; if(cn == 2) printf $2}; /b203|j151/ {printf "\t" $2} END {print ""}' file


How can I separate the output...
1,972
Posted By palex
That is great.... thanks so much! The only issue...
That is great.... thanks so much! The only issue is that each line of the output file runs together. How can I add a line separator?
1,972
Posted By palex
Xml to csv (again)
Hello,
I have copied .xml code for a single item below. I am trying to extract three items (field indices*b244 (second occurrence), b203, and j151), so the desired output would be:
...
Forum: OS X (Apple) 05-05-2018
954
Posted By palex
Piping to grep with pbpaste
cat file

1 aaa
2 bbb
3 ccc
4 ddd

In TextEdit, I then copy the characters “ccc” to the clipboard. The problem is that the following command gives no output:

bash-3.2$ pbpaste | grep -...
584
Posted By palex
Column 11 of file2 was duplicated in the output,...
Column 11 of file2 was duplicated in the output, but this works for me. Thank you so much!
584
Posted By palex
Field matching in two data files
Hello,
I am looking to output all of the lines from file2 whose 11th field is present in the first field in file1. Then the second field from file1 should be appended as such:

file1:
2222 0.35...
695
Posted By palex
I did play around with the code, but I couldn't...
I did play around with the code, but I couldn't figure out the syntax of the array (I looked on several pages also). Something like this came to mind, but is clearly wrong:

awk -F"\t" '
FNR ==...
695
Posted By palex
One followup question... If I wanted to include...
One followup question... If I wanted to include an additional column from file2 to the output, how would I modify that code? For example, including column 7 as such:


9780205647040 51.94 20 ...
695
Posted By palex
I'm using XQuartz on a Mac OS (El Capitan) with a...
I'm using XQuartz on a Mac OS (El Capitan) with a bash shell. What I think would work would be something like:

awk '{print $1}' file1 > temp
grep -f temp file2

but there may be up to 10k...
695
Posted By palex
Search data file2 for entries in data file1
Hello,
I have two data files:

file1:
9780205646999 28.31 20 Cengage
9780205647040 51.94 20 Cengage
9780205660568 49.11 20 Cengage
9780205696758 51.75 20 ...
Forum: UNIX and Linux Applications 03-14-2017
13,132
Posted By palex
Great, I know how to remove the fourth column...
Great, I know how to remove the fourth column from there. Thanks so much for your help!
Forum: UNIX and Linux Applications 03-14-2017
13,132
Posted By palex
Yes, the second entry should be suppressed.
Yes, the second entry should be suppressed.
Forum: UNIX and Linux Applications 03-14-2017
13,132
Posted By palex
Very close... The following is the first four...
Very close... The following is the first four lines of output when I run the command on the entire data file:

9781328740472 Peepers 7.99
10.99
9780544503205 Curious George Fire Dog Rescue...
Forum: UNIX and Linux Applications 03-14-2017
13,132
Posted By palex
RudiC - Yes, thanks so much, that is essentially...
RudiC - Yes, thanks so much, that is essentially what I need. The output line would be one of many with the same structure, so I think I need a \n somewhere, but couldn't quite get it to work.
Forum: UNIX and Linux Applications 03-14-2017
13,132
Posted By palex
drysdalk - It will be a weekly task, and there...
drysdalk - It will be a weekly task, and there are about 2.5M lines per file, so Excel would not be practical, unfortunately. Thanks, though!

---------- Post updated 03-14-17 at 07:13 AM...
Forum: UNIX and Linux Applications 03-13-2017
13,132
Posted By palex
Hello, I want to thank you so much for taking...
Hello,
I want to thank you so much for taking the time to do this. After replacing 1-data1 with the xml filename, I receive the following:


-----
Sampled lines from data file :
./z: line 19:...
Forum: UNIX and Linux Applications 03-11-2017
13,132
Posted By palex
Thanks for the replies. I have copied .xml code...
Thanks for the replies. I have copied .xml code for a single item below. I am trying to extract three items (field indices a001, b203, and j151), so the desired output would be:

9781328740472 ...
Forum: UNIX and Linux Applications 03-02-2017
13,132
Posted By palex
Xml to csv
Hello,
Does anyone know of a way to convert an .xml file (ONIX) to something more workable, like a .csv (or even .xls) file? Ideally something on the command line would be ideal, but not absolutely...
591
Posted By palex
Perfect!
Perfect!
591
Posted By palex
I wish to extract *all* such numbers (beginning...
I wish to extract *all* such numbers (beginning with 978) from the file, irrespective of the tags.

Mac OS - El Capitan, XQuartz 2.7.8

Yes, it appears that grep has the -o option.

Thanks!
591
Posted By palex
Sample from the .xml file: ...
Sample from the .xml file:

<PriceAmount>42.97</PriceAmount>
<CurrencyCode>USD</CurrencyCode>
</Price>
</SupplyDetail>
</Product>
<Product>
<RecordReference>9780028608129</RecordReference>...
Showing results 1 to 25 of 90

 

Featured Tech Videos

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