Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Kipnep70

    Help converting list of strings to Object

    Hello. I'm hoping somebody could help me figure out the following. I have data that I've pulled down from a website using invoke-webrequest. I've got the data cleaned up and now is in an system.string type object. I want to create a hash table and possibly convert to a pscustomobject, but...
  2. Kipnep70

    Help with parsing data

    I guess I was trying to overcomplicate it by storing everything until the end. thank you.
  3. Kipnep70

    Help with parsing data

    My data looks like the following: id 34 name SERVERABC port_count 2 type generic mask 1111111111111111111111111111111111111111111111111111111111111111 iogrp_count 4 status online site_id site_name host_cluster_id host_cluster_name WWPN 5001438002A3005A node_logged_in_count 8 state active WWPN...
  4. Kipnep70

    removing duplicate lines depending on value of $1

    Thanks for your suggestions.. I ended up just filtering out the "grapes" into a 2nd file. Then doing something like awk 'NR==FNR && !x[$4,$5]++' wanted_info.txt print_this_if_not_in_first_file.txt Thanks!
  5. Kipnep70

    removing duplicate lines depending on value of $1

    I have a file that looks like this: apple4 yellow apple1 red apple6 blue apple3 green grape red grape purple apple68 yellow apple32 red apple98 orange grape yellow I would like to remove duplicate lines using the following: awk '!x[$2]++' However I only want to remove duplicates if $1...
  6. Kipnep70

    Help parsing data in sets

    Wondering if anybody could help... I've clipped some of the raw data, but you'll get the general idea. Raw data: CL1-A CL1-A CL1-A CL1-A CL1-A CL1-A CL1-A CL1-A CL1-A CL1-A CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B CL1-B...
  7. Kipnep70

    Sort Help Request

    thank you so much for the explanation... I feel almost embarrassed now for not seeing that. I really appreciate your help.
  8. Kipnep70

    Sort Help Request

    Can you help me understand how the populating of dshosts[$2] works... this is what I understand: If I have: DN: castle DS: disk1 DS: disk2 GI: windows then /^DS/ { dshosts[$2]=dshosts[$2]dn" " } really means /^DS/ { dshosts[disk1]=disk1castle" " } /^DS/ { dshosts[disk2]=disk2castle" " }...
  9. Kipnep70

    Sort Help Request

    Actually I updated this from.. ....awk 'BEGIN{RS="Q"}{print "GI: "$6,$0}...... to ....awk 'BEGIN{RS="Q"}{print "GI: "$NF,$0}.......
  10. Kipnep70

    Sort Help Request

    So I ended up trying to rearrange the lines so the last line was moved to the first line of each record (separated by GUEST). It works.. but its long and ugly: sed -n -e 's/GUEST/Q/p' -e '/^DN/p' -e '/^DS/p' -e '/^GI/p' /tmp/vStorage | awk 'BEGIN{RS="Q"}{print "GI: "$6,$0}'|awk...
  11. Kipnep70

    Sort Help Request

    One more question that I can't figure out.. There's one more field I'd like to track in the equation.. GUEST DN: apple DS: G-WE01-E20A-SLS-4 DS: G-WE01-E203-SLS-4 GI: windows GUEST DN: grape DS: G-WE01-E20B-SLS-4 GI: unix GUEST DN: banana DS: G-WE01-E20A-SLS-4 DS: G-WE01-E200-SLS-4 GI: Solaris...
  12. Kipnep70

    Sort Help Request

    Thanks PHV .. I still novice when it comes to associative arrays.
  13. Kipnep70

    Sort Help Request

    This is the type of data I'm working with: GUEST DN: apple DS: G-WE01-E20A-SLS-4 DS: G-WE01-E203-SLS-4 GUEST DN: grape DS: G-WE01-E20B-SLS-4 GUEST DN: banana DS: G-WE01-E20A-SLS-4 DS: G-WE01-E200-SLS-4 I have two records here, the "GUEST" line I can use as my record separator. Basically I'd...
  14. Kipnep70

    help modify last character in last line

    Using BladeLogic NSH (Simliar to ZSH)... System Variables: x=myserver y=myfile awk 'BEGIN{OFS=","}{if (NR < 2) print "\042""'"$x"'""\042","\042""'"$y"'""\042","\042"$0; else print $0}END{print "\042"" ^ENDOFRECORD^"}' //${x}//usr/openv/netbackup/${y} >> //myserver/tmp/inprogress/exclude.final...
  15. Kipnep70

    Combining Awk programs

    I have a script that uses several awk one liners to manipulate data. Does it make sense to have several awk programs in one shell script, or is it always possible to combine the awk programs? Example: #Running bperror to get data /usr/openv/netbackup/bin/admincmd/bperror -backstat -l -d...
  16. Kipnep70

    Filtering data

    Wow. Nice. Can you explain what the awk statements are doing? I understand it up until this point: ...,/Serial Number/?RS:FS}' I know printf is printing two strings, .. but are you searching for "Serial Number" again? Also what does ?RS:FS do? Record Separater:Field Seperator? Not sure...
  17. Kipnep70

    Filtering data

    My input looks like the following: Device Name : "/dev/rmt/c56t0d0BESTnb" Passthru Name: "/dev/sctl/c56t0l0" Volume Header: "" Port: -1; Bus: -1; Target: -1; LUN: -1 Inquiry : "HP Ultrium 3-SCSI M66S" Vendor ID : "HP " Product ID : "Ultrium 3-SCSI " Product Rev: "M66S" Serial...
  18. Kipnep70

    Please explain following awk

    I know what it does.. but I don't understand the syntax: awk '!x[$0]++' How does this remove duplicate lines out of a file?
  19. Kipnep70

    Help Printing decimal with mixed fields

    I think I figured it out. .... | awk 'BEGIN { OFMT = "%2.2f" }; {print $2, $12, $13, $14/86400+25569-6/24, $15, $16/86400+25569-6/24, $19, $20}' If anybody has a better way, let me know. Thanks
  20. Kipnep70

    Help Printing decimal with mixed fields

    I have a line that looks like this: Jane likes math 13 My awk program: awk '{print $1, $2, $3/14}' Results: Jane likes 0 Desired: Jane likes 0.21 I was playing with the printf command but I can't get it to print both numbers and words out. # echo "40052.96 hello" |awk '{printf...

Part and Inventory Search

Back
Top