Sponsored Content
Top Forums Shell Programming and Scripting How to print string on screen according the fixed length? Post 302250705 by ranjithpr on Friday 24th of October 2008 05:29:00 AM
Old 10-24-2008
$ entry_name="joke:hello:yellow:blue:default"
$ echo $entry_name|awk '{ i=1; while(i<=length) { print substr($0,i,12); i+=12} }'
joke:hello:y
ellow:blue:d
efault
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. Shell Programming and Scripting

print a file with one column having fixed character length

Hi guys, I have tried to find a solution for this problem but couln't. If anyone of you have an Idea do help me. INPUT_FILE with three columns shown to be separated by - sign A5BNK723NVI - 1 - 294 A7QZM0VIT - 251 - 537 A7NU3411V - 245 - 527 I want an output file in which First column... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies

3. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

4. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

5. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

6. Shell Programming and Scripting

awk to print fixed length columns to right side

Hi, I am in a situation to print the message on a column, where the each line starting position should be same. For example code: HOSTNAME1="1.2.3.4.5.6.7" TARGET_DIR="/tmp" echo "HOSTNAME1:" "$HOSTNAME1" | awk -v var="Everyone" '{len=55-length;printf("%s%*s\n",$0,len,var)}' echo... (4 Replies)
Discussion started by: tprabhaker
4 Replies

7. Shell Programming and Scripting

Split a fixed length file bases on last occurence of string

Hi, I need to split a file based on last occurece of a string. PFB the explanation I have a file in following format aaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccc ddddddddddddddddddddddddddd 3186rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr... (4 Replies)
Discussion started by: Neelkanth
4 Replies

8. Shell Programming and Scripting

Print entire line only if certain fixed character matches the string

Hi All, I have a file testarun.txt contains the below lines and i want to print the lines if the character positions 7-8 matches 01. 201401011111 201401022222 201402013333 201402024444 201403015555 201403026666 201404017777 201404028888 201405019999 201405020000 I am trying the... (4 Replies)
Discussion started by: Arunprasad
4 Replies

9. Shell Programming and Scripting

Break one long string into multiple fixed length lines

This is actually a KSH under Unix System Services (Z/OS), but hoping I can get a standard AIX/KSH solution to work... I have a very large, single line file in Windows, that we download via FTP, with the "SITE WRAP" option, into a Z/OS file with an LRECL of 200. This essentially breaks the single... (4 Replies)
Discussion started by: bubbawuzhere
4 Replies

10. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
DBATBL(1)						      General Commands Manual							 DBATBL(1)

NAME
dbatbl - Manage on-disk reference tables for DB-ALLe SYNOPSIS
dbatbl [command] [options] [args...] DESCRIPTION
This tool allows to index and query the tables that are needed for normal functioning of DB-ALLe. dbatbl always requires a non-switch argument, that indicates what is the operation that should be performed: help Print a help summary. help manpage Print this manpage. cat tableid [tableid [...]] Output all the contents of a WMO B table.. grep string Output all the contents of the local B table whose description contains the given string.. expand table-entry [table-entry [...]] Describe a WMO B table entry or expand a WMO D table entry in its components.. expandcode varcode [varcode [...]] Expand the value of a packed variable code. index [options] filename index-id Index the contents of a table file. describe [options] what [values] Invoke the formatter to describe the given values. Supported so far are: "level ltype l1 l2", "trange pind p1 p2". OPTIONS
dbatbl follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Option for command cat -?, --help print an help message -c, --csv output variables in CSV format Option for command grep -?, --help print an help message -c, --csv output variables in CSV format Option for command expand -?, --help print an help message Option for command expandcode -?, --help print an help message Option for command index -?, --help print an help message -t type, --type=type format of the table to index ('b', 'd', 'conv') Option for command describe -?, --help print an help message AUTHOR
dbatbl has been written by Enrico Zini <enrico@enricozini.com> for ARPA Emilia Romagna, Servizio Idrometeorologico. may 16, 2012 DBATBL(1)
All times are GMT -4. The time now is 11:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy