親愛的社區,
提取逗號分隔數字“xxxxx,xxxxx,xxxxx”後跟文本術語(“Project#1”)的最佳方法是什麼。
請看下面的完整示例:
項目#1 @ 15964,15899,15839
項目#1 @ 15961,15897,15837
項目#1 @ xxxxx,xxxxx,xxxxx ...... ..,因此需要提取15個數字字符。數量因項目而異。
理想情況下,提取的數值需要保存在主文檔的單獨列中。
謝謝。
安東
如果這是純文本文件,請嘗試使用導入嚮導。有幾種方法,如果文件看起來是常規的,那麼這是最漂亮的:
Open(
"C:\Users\v1\Desktop\xxxx.csv",
columns(
Omitted Column( . ),
New Column( "c000002 2", Numeric, "Continuous", Format( "Best", 12 ) ),
Omitted Column( . ),
New Column( "c000004 2", Numeric, "Continuous", Format( "Best", 12 ) ),
Omitted Column( . ),
New Column( "c000006", Numeric, "Continuous", Format( "Best", 12 ) ),
Omitted Column( . ),
New Column( "c000008", Character, "Nominal" )
),
Import Settings(
Fixed Column Widths( 9, 2, 2, 5, 2, 5, 2, 101 ),
Strip Quotes( 0 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 0 ),
Column Names Start( 1 ),
Data Starts( 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
)
我使用“導入預覽”並選擇“固定寬度列”選項,用鼠標定位分隔線,轉到下一個屏幕並排除不需要的列。
您也可以嘗試分隔列,並選擇逗號+空格(不是空格)並獲得類似的東西。