![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to count number of delimiters in a file name | ayanbiswas | UNIX for Dummies Questions & Answers | 4 | 07-02-2008 05:57 AM |
| Adding a columnfrom a specifit line number to a specific line number | Ezy | Shell Programming and Scripting | 2 | 05-12-2008 08:29 AM |
| Appending line number to each line and getting total number of lines | chiru_h | Shell Programming and Scripting | 2 | 03-25-2008 10:19 AM |
| awk script to find the number of files | uni_ajay_r | Shell Programming and Scripting | 4 | 10-31-2006 06:58 PM |
| Unix Script with line number at beginning of each line. | mascorro | Shell Programming and Scripting | 5 | 06-19-2006 04:34 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Script to find the number of tab delimiters in a line
Hi,
I need to find the number of tab delimiters in the first line of a file.So using word=`head -1 files.txt` I have extracted the first line of file into a variable word.It has 20 tab delimted columns.So can anyone help me in finding the number of delimiters? I am using csh and I am a beginner.I feel like printf and awk are not working. Not sure Also I would like to know how can I call this shell using Autosys Jobs by giving the file name as a parameter.Do I need to write the script something like a function? As of now I am reading from the user as echoing and reading the filename.But how I will implement in Autosys? Please help. Thanks, Poornima |
|
||||
|
Few people here are good with csh, me included. There are good reasons to avoid it.
However, you can get the answer with awk. Try gawk or nawk if you have them. Code:
head -1 file | awk -F'*' '{print $NF -1 }'
Last edited by jim mcnamara; 09-29-2008 at 10:36 AM.. Reason: gotgot to make FS == a tab |
![]() |
| Bookmarks |
| Tags |
| autosys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|