Awk: how to separate a field?

Hello!
Instead of having one awk field for date and time I wanna seperate them in two. I think the easiest would be to replace in every row the eleventh character by a space or tab. Just don't know how to do it.
2008/03/01/00:00:00 -28.8748 +32.6493
Thanks in advance
Bastian

Your question is somewhat leading because if you're already using awk you may have to integrate the rule into an existing workflow.
That said, the simplest way to replace the 11th character with a space would be:
awk '{print substr($0,1,10)" "substr($0,12,$NF)}'
This takes $0 (the input string) and prints the first 10 characters followed by a space followed by characters 12 through the end.
Another approach would be to use field delimiters - useful if the date format varies (e.g. uses single digit months):
awk -F/ '{print $1"/"$2"/"$3" "$4}'
In this model the input string is broken into fields based on the character /
then it prints the first two fields followed by a / then the third field followed by a space, and finally the fourth field (or in this case, remaining text).
There are countless other methods, too including sprintf.

Similar Messages

  • How to separate two fields in Text element of Smartform??

    Hi,
    I am trying to separate two fields by a space, for example &WA_ACC-G_L_ACCT& &GV_ACCT_TXT&, but evry time I save the smartform the space disappears and output is continous like 56000Product Materials.
    The desired Output I am looking for is something like 
    56000  Product Materials.
    How do I do this ??
    Thanks

    Hi ,
      U can try what Narendra has said ,if u are not able achieve then do this :
    Create constant c_space type char1 value space
    and try printing it between ur variables, ur problem is solved this way
    Reward if u find it useful
    Regards
    Sapsurfer

  • How to separate date fields from t:calender ip?

    Hi All,
    I am using tomahawk calender in my jsf page.
    <t:inputCalendar id="startDate" value="#{bean.startDate}" renderAsPopup="true" popupDateFormat="MM/dd/yyyy" forceId="true" />
    Inside bean , I have
    Date startDate= new Date();
    when I print this startDate, I get
    Tue Apr 24 00:00:00 IST 2007
    I want to get date and month separately..how to do this?
    because in Date class getDate() method is deprecated...
    Thanks in advance...

    I do not have 2008, but you should be able to edit the subreport and run it seperate of the main report.
    add a formula to the sub to return the dates that are comming from the main report.
    Check the links to the sub-report.
    You should have two links, one for mindate one for max
    Check to see if you have a checkbox above a section that says
    Select data in subreport based on field.
    This advice may be way off for 2008.  but is valid in CRXI

  • How to separate a field separated by semi colons

    Hi - thought I would give this a try - any help is appreciated.
    I have a field separated by semi colons - for example - prod1;prod2;prod3
    In a cross tab I'm trying to show which products have a date in them and put an X there. My problem is if the field is like my example - it only shows once and instead of listing each single product as a product - it shows it as one like the example.
    I would like to have a column for each product with and X under each.
    I hope this is enough information.
    Any help is much appreciated.
    Thanks.
    Bill

    Marlene,
    It all just depends on what you are trying to do. If you have a set number values in the string and you want each of them in their own column then it fairly easy...
    SPLIT ({Command.jce_cest}, ";") [1]
    SPLIT ({Command.jce_cest}, ";") [2]
    SPLIT ({Command.jce_cest}, ";") [3]
    SPLIT ({Command.jce_cest}, ";") [4]
    HTH,
    Jason

  • How can i redirect 5 choice options from a drop down list into 5 separate text fields?

    I have a number of drop down lists which push one of 5 choices to a text field on another page.
    I want to be able to push each choice from one drop down field to a separate field, so that it is not possible to duplicate the drop down choice.
    The resulting page is going to be locked.
    What script do I need to use to send each of the five choices specifically to five separate text fields?
    Thanks for the insight.

    Hi Paul,
    I've had a look at the sample script you posted. I'm not sure how to make it work with the form I'm creating. (I sent it to you earlier.) Would you mind setting one of the fields up on my form so that I can get an idea of how to then push the choices set up on the "visible on screen only" to the textfields which are locked on the visible page? Do i lock the fields in the same way?
    Will I need to create a new script for each of the arrays I'll be creating? for example, myScript1, myScript2, my Script3....
    Why do i need a reset button?
    Nellie

  • CO-PA : How to define separate value fields for Revenue & Incoming SO

    Hello friends,
    In CO-PA reports, how can I see separate value fields for Revenue (ERLOS) and "Incoming Sales Order" ? I created a value field for incoming sales order value.
    But when I goto customizing for CO-PA, Transfer of Incoming Sales Orders and Transfer of Billing Documents refer to the same tcode KE4I. So its not possible for me to define a condition type to 2 separate value fields.....how can I see both incoming sales order value and revenue (from invoices) together ?
    Any advice you can give me would be greatly appreciated.
    Cheers
    Ken

    Hi
    In COPA value flow from a condition type thru a value feild.
    One condition type can be assinged to only one value feild ratio
    Condition    :        Value feild
         1                         1
    But where as ratio between
    Value feild              :         Condition
          1                                     N
    Apart from above check the operating concern check for the values & characteristics and activate.
    Thanks
    Colin Thomas

  • I don't have my search field anymore, only the url field. I know I can seach in it, but I want my separate search field back. How do I do that?

    Not sure when it happened and I am sure it is just a setting or something, but I can't find where I get the search field back. I see it when I open the customize the tool bar, but it disappears when I close it. I want to search from Google and the URL search bar does not give me that option, only Google Maps & places.
    How do I get back that separate search field?
    Thanks.

    Make sure that toolbars like the "Navigation Toolbar" and the "Bookmarks Toolbar" are visible: "View > Toolbars"
    * If items are missing then open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"
    * If a missing item is in the toolbar palette then drag it back from the Customize window on the toolbar
    * If you do not see an item on a toolbar and in the toolbar palette then click the "Restore Default Set" button to restore the default toolbar set up.
    See also:
    * http://kb.mozillazine.org/Toolbar_customization
    * https://support.mozilla.com/kb/Back+and+forward+or+other+toolbar+items+are+missing

  • How to separate debit and credit values in gl statement report (daywise)

    hi
    experts,
    i have report.
    selection criteria is
    chars of account.
    gl account
    date .
    how to separate debit and credit values in gl statement?.(i know there is a indicator shkzg).
    but send me code.
    op
    date,   total credit,total debit , balances.
    also calculate opening and closing balance.
    u created such type of report then plz help me.
    thanks&regards.\
    ajay.

    Hi,
    Usually it can be determined using the field shkzg. If it contain 'S' its debit and if it contains 'H' then its credit.
    Before showing the amount you need to do like;
    IF wa_gl-shkzg = 'H'.
    wa_gl-dmbtr = wa_gl-dmbtr * (-1). " dbmtr - amount
    ENDIF.
    This will solve your problem.
    Regards
    Karthik D
    Edited by: Karthik D on Jun 3, 2009 12:29 PM

  • How to make optional fields in alv report

    Hello Experts,
                             Can anyone tell me how to do fields as optional in ALV report Output. My requirement is I want to display only few fields as default in my output and remaining fields will be added if needed by clicking the layout button.For clear example i have totally 10 fields in that fields i want to display only 5 fields and remaining 5 fields will be optional and when i click on layout button then i can add those 5 fields also. Can anyone tell me how to do this.
    Thanks,
    Vinod.

    Hi Vinod,
    As suggested by Eitan, kindly use the attribute NO_OUT = 'X' in field catalog for the appropriate column.  Based on that we can hide the fields.
         L_FIELDCAT-NO_OUT = 'X'.
    Also we can group the hidden fields in layout using SP_GROUP attribute in Field catalog as shown below. Based on that, we can separate the fields based on category/group.
         L_FIELDCAT-SP_GROUP = 'A'.
    Regards
    Rajkumar Narasimman

  • [Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line

    Introduction
    Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands.
    Solution
    For character data fields, optional terminating characters allow you to mark the end of each field in a data file with a field terminator, as well as the end of each row with a row terminator. If a terminator character occurs within the data, it is interpreted
    as a terminator, not as data, and the data after that character is interpreted and belongs to the next field or record. I have done a test, if you use BULK INSERT or BCP commands and set the multiple field terminators, you can refer to the following command.
    In Windows command line,
    bcp <Databasename.schema.tablename> out “<path>” –c –t –r –T
    For example, you can export data from the Department table with bcp command and use the comma and colon (,:) as one field terminator.
    bcp AdventureWorks.HumanResources.Department out C:\myDepartment.txt -c -t ,: -r \n –T
    The txt file as follows:
    However, if you want to bcp by using multiple field terminators the same as the following command, which will still use the last terminator defined by default.
    bcp AdventureWorks.HumanResources.Department in C:\myDepartment.txt -c -t , -r \n -t: –T
    The txt file as follows:
    When multiple field terminators means multiple fields, you use the below comma separated format,
    column1,,column2,,,column3
    In this occasion, you only separate 3 fields (column1, column2 and column3). In fact, after testing, there will be 6 fields here. That is the significance of a field terminator (comma in this case).
    Meanwhile, using BULK INSERT to import the data of the data file into the SQL table, if you specify terminator for BULK import, you can only set multiple characters as one terminator in the BULK INSERT statement.
    USE <testdatabase>;
    GO
    BULK INSERT <your table> FROM ‘<Path>’
     WITH (
    DATAFILETYPE = ' char/native/ widechar /widenative',
     FIELDTERMINATOR = ' field_terminator',
    For example, using BULK INSERT to import the data of C:\myDepartment.txt data file into the DepartmentTest table, the field terminator (,:) must be declared in the statement.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,:’,
    The new table contains like as follows:  
    We could not declare multiple field terminators (, and :) in the Query statement,  as the following format, a duplicate error will occur.
    In SQL Server Management Studio Query Editor:
    BULK INSERT AdventureWorks.HumanResources.DepartmentTest FROM ‘C:\myDepartment.txt’
     WITH (
    DATAFILETYPE = ‘char',
    FIELDTERMINATOR = ‘,’,
    FIELDTERMINATOR = ‘:’
    However, if you want to use a data file with fewer or more fields, we can implement via setting extra field length to 0 for fewer fields or omitting or skipping more fields during the bulk copy procedure.  
    More Information
    For more information about filed terminators, you can review the following article.
    http://technet.microsoft.com/en-us/library/aa196735(v=sql.80).aspx
    http://social.technet.microsoft.com/Forums/en-US/d2fa4b1e-3bd4-4379-bc30-389202a99ae2/multiple-field-terminators-in-bulk-insert-or-bcp?forum=sqlgetsta
    http://technet.microsoft.com/en-us/library/ms191485.aspx
    http://technet.microsoft.com/en-us/library/aa173858(v=sql.80).aspx
    http://technet.microsoft.com/en-us/library/aa173842(v=sql.80).aspx
    Applies to
    SQL Server 2012
    SQL Server 2008R2
    SQL Server 2005
    SQL Server 2000
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to make expandable field in pdf forms?

    Does anyone here know how to make expandable field in a PDF form?
    I want the field, originally appear to be a 1-liner, to expands when you put in more text and everything that is underneath the expandable field shifts or moves down.
    pls help.
    Thanks!

    No, LiveCycle Designer is not included in Creative Cloud and is available only for Windows. It was included with the Windows version of Acrobat Pro before Acrobat 11 but is now a separate program and about $300.

  • Separate search field in Safari

    Ugh, I finally got around to updating Safari. I want to add my voice to others saying just how much I HATE not having a separate search field. Seriously, I might as well just use Chrome now. Making this one field is a horrible UX idea...aren't you guys suposed to pretty good at that? I hope the guy that thought that was a good idea is no longer working on Safari.

    stevenwright wrote:
    Come on Apple!
    Steven ~ Let them know via this page:
    http://www.apple.com/feedback/safari.html

  • Can any one tell me how to work with field exit????

    Hi
    Can any one tell me how to work with field exit I know how to create them. I want to know how it works. Actually I want to create a field exit for T-CODE MIRO. Where I want to put the value ebeln of the PO Reference tab into the Assignment of details tab and make Assignment field disable.
    Thanks in advance

    Hi,
    Follow the Steps,
    1. Go to CMOD transaction
    2. From the menu "GOTO->TEXT ENHANCEMENTS->DATA ELEMENTS-   ->NEW DE CUST DOCU".
    3. In the displayed box specify the data element and
       press either "CHANGE" or " Ref to screen" button
    4. CHANGE button is for defining the documentation
    5. "Ref. to screen" if for assigning the screen in which
       a field has the this type data element.
       Note: You should have used this data element for a   
             field in that screen.
    6. Now it will ask for Function Module name, specify the
       FM name and double click it. It will go to the editor.
    7. Now using the Import parameters code accordingly
    8. Activate and go back
    9. Now "Assign the created program ( that is FM) to the
       screen by specifying the Program name and Screen
       number.
    10. Now save and activate.
    Note: No need to create a separate project for creating field exit through transaction CMOD.
    I hope this is suffice.
    Regs,
    Venkat Ramanan

  • How to separate internaltable values

    how to separete internal table fields 
    i have a internal table t_table with some fields , I want to separate the values in the internal table by using semicolon and pass to a string type field
    i need something like this
    800;1000;100000456;2009;001;D....................
    HOW TO SEPARATE THE VALUES FROM INTERNALTABLE?
    Moderator message: duplicate post locked.
    Edited by: Thomas Zloch on Aug 19, 2011 4:02 PM

    I have not optimized the code (it's a bit slow).  Is this what you are looking for?
    See attachment in LV8.2
    It does not sort the arrays but splits them in the order as they are found.  The front part of the code is to generate 500 random numbers in two groups 100 to 109 & 300 to 309, to represent the numbers you have shown.
    R
    EDIT:  Question:  When you say "split in real time", are the numbers already into an array or it is prior to being in an array?
    Message Edited by JoeLabView on 09-11-2008 01:47 PM
    Attachments:
    UnsortedSplitArray.vi ‏19 KB

  • How to separate this hyperlink using function in Infopath?

    HI All,
    How to separate this hyperlink using function in Infopath?http://Site:90/Lists/attachment/Attachments/6/Capture.PNGhttp://Site:90/Lists/attachment/Attachments/6/Capture1.PNG
    Actually I have two fields
    in infopath form, attachment field and hyperlink field. If attachment attached, then set value for hyperlink field value as attachment link.
    When I attach more than one attachment, then hyperlink field value gets like above link. I need to separate into two link. How to achieve this?

    try this 
    substring(text, start_position, char_count)
    http://office.microsoft.com/en-us/infopath-help/add-formulas-and-functions-in-infopath-2010-HA101821255.aspx#_Text_functions
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

Maybe you are looking for

  • Printer and scanner

    i have an epson stylus sx 110(printer,scanner and copy) which  works fine with cups and gutenprint till i install sane..when i do that administration printing doesn't recognize the printer anymore.i tried proprietary driver but same thing happens..is

  • System Passwords

    Hi, I created an oracle 10g server on a windows server2003 platform. I installed 10gDB R2 on the server and everything went great, perfect install - i could get into the EM page on port http:myserver:1158/em and create users etc via EM I then install

  • Child part demand for Subcontractor parts not reflecting in SNP

    Hi I have a situation where the demand for child parts are not reflecting in SNP. The demand for the parent parts are visible in SNP, but the demand in turn is not being reflected against child parts that are Subcontractor parts. The demand for child

  • How do I enter my administrator password in Terminal?

    How do I enter my administrator password in Terminal?

  • BAPI for create meterial component

    Hi experts    Which bapi can create meterial componet for an Activity, the same  as use TCODE cj20n create a network->create activity->create meterial componet BR Chris