- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: select statement for specific pattern
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 04:32 AM
тАО07-07-2006 04:32 AM
Data looks like:
01 002 120
01 002 160
01 005 120
01 002 125
01 1 00 02 1
01 2 00 02 3
etc.
I need to only pull this type of format:
01 002 120
Next question:
How to update, this type of format:
01 002 120
To this type of format:
01 2 00 02 3
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 05:13 AM
тАО07-07-2006 05:13 AM
Re: select statement for specific pattern
It's not fully clear, but you if format means 3 fields and 5 fields, so:
awk 'NF==5 {print; next}
NF==3 {do_what_you_need; next}' input_file > output_file
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 05:21 AM
тАО07-07-2006 05:21 AM
Re: select statement for specific pattern
Bascially the format that I need to find is
Where col like ....
99 999 999
## ### ###
Not an awk statement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 05:34 AM
тАО07-07-2006 05:34 AM
Re: select statement for specific pattern
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 06:16 AM
тАО07-07-2006 06:16 AM
Re: select statement for specific pattern
Here's what you need to do to convert all 3-field records to 5-field records:
# sed 's/^\(..\) \(.\)\(..\) \(.\)\(..\)$/\1 \2 \3 0\4 \5/p' inputfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 06:20 AM
тАО07-07-2006 06:20 AM
Re: select statement for specific pattern
I need to run a select statement on a table in Oracle.
have a column that I need to select on:
Data looks like:
01 002 120
01 002 160
01 005 120
01 002 125
01 1 00 02 1
01 2 00 02 3
01 2 03 02 3
01 042 160
01 2 06 02 3
01 202 167
etc.
I need to only pull this type of format:
## ### ###
select col1 from table where col1 like??
Next question:
How to update, this type of format:
## ### ###
To this type of format:
## # ## ## #
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 06:28 AM
тАО07-07-2006 06:28 AM
SolutionHere's a select statement that accomplishes what you're looking for (notice the use of the substr() function):
select id "id",substr(id,1,2)||' '||substr(id,4,1)||' '||
substr(id,5,2)||' '||substr(id,8,2)||' '||substr(id,10,1) "formatted id"
from tab01
where id like '__ ___ ___'
;
You might consider selecting into another table instead of updating rows in the existing table.
A link to the Oracle 9i SQL reference:
http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/toc.htm
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-07-2006 06:32 AM
тАО07-07-2006 06:32 AM
Re: select statement for specific pattern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-11-2006 04:59 AM
тАО07-11-2006 04:59 AM