If I have a data file delimited by | how do I select just the first column of data?
1929393|dafda|d0354
492394|flat|dl303
239095860|daeio|3901
If I have thousands of rows of data like this how do I select and pull just the first column?
thanks.
select a column of data
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
There is probably a way of doing what you want with a regular expression, but here is another:
do a find replace on the field separators (the pipe symbols) and replace with tabs (\t) - this should line up your columns.
Use Block Select mode and select the column you want.
cut and paste into a new document.
Job done.
You will need to use a fixed font and in the new document you can set the preferences for the document to get of any trailing tabs and spaces.
do a find replace on the field separators (the pipe symbols) and replace with tabs (\t) - this should line up your columns.
Use Block Select mode and select the column you want.
cut and paste into a new document.
Job done.
You will need to use a fixed font and in the new document you can set the preferences for the document to get of any trailing tabs and spaces.
ACRobin's idea works, but needs some tweaking:
Firstly, replacing with "\t" only works if you select the Regular expression check box. Then, if you have POSIX regular expression syntax enabled under Configure->Preferences->Editor, you need to use "\|" as the Find string rather than just "|".
Secondly, you would need to increase the tab spacing to make the columns line up. Under View->Document Properties->Tabulation, set Default tab spacing to a value larger than the length of the longest value in the first column. In the example, "239095860" is the longest value, which is 9 characters in length, so you would need to set the tab spacing to at least 10.
It seems to me that it would be easier just to delete everything after the first delimiter using a Replace operation:
Find what: \|.*
Replace with: (nothing)
Select the Regular expression check box
Click Replace All
This assumes you have POSIX regular expression syntax enabled as described above.
Firstly, replacing with "\t" only works if you select the Regular expression check box. Then, if you have POSIX regular expression syntax enabled under Configure->Preferences->Editor, you need to use "\|" as the Find string rather than just "|".
Secondly, you would need to increase the tab spacing to make the columns line up. Under View->Document Properties->Tabulation, set Default tab spacing to a value larger than the length of the longest value in the first column. In the example, "239095860" is the longest value, which is 9 characters in length, so you would need to set the tab spacing to at least 10.
It seems to me that it would be easier just to delete everything after the first delimiter using a Replace operation:
Find what: \|.*
Replace with: (nothing)
Select the Regular expression check box
Click Replace All
This assumes you have POSIX regular expression syntax enabled as described above.