Sponsored Content
Full Discussion: Aligning a file
Top Forums Shell Programming and Scripting Aligning a file Post 302914090 by ctrld on Thursday 21st of August 2014 10:36:36 PM
Old 08-21-2014
Thanks Corona and Yoda.

I had already tried column command and it is aligning the lines without "==>" also.
For example, if I have a line like below in my input.txt the output goes wrong.

Code:
cat input.txt

abc
qwert
qwer
afweferf
wdfwefwe ==> kjhjkwdd
mnmn ==> jkjkjwekj
poiu ==> lklklke
tytyutut ==> olkjmnsmn
This text need not be aligned.

column -t input.txt
Code:
abc
qwert
qwer
afweferf
wdfwefwe  ==>   kjhjkwdd
mnmn      ==>   jkjkjwekj
poiu      ==>   lklklke
tytyutut  ==>   olkjmnsmn
This      text  need       not  be  aligned.

If I try column -s "==>" -t input.txt:
Code:
 
column -s "==>" -t input.txt
abc
qwert
qwer
afweferf
wdfwefwe                         kjhjkwdd
mnmn                             jkjkjwekj
poiu                             lklklke
tytyutut                         olkjmnsmn
This text need not be aligned.

The ==> is getting removed.

---------- Post updated at 08:06 AM ---------- Previous update was at 07:30 AM ----------

I just noticed one thing, the text before "==>" does not exceed 50 characters in max length. I think placing the ==> at exactly 50th character position should do the trick.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Aligning Characters in Bash/Beautiful Screens

Howdy, Supposing I want to output the following code to the screen in a bash script, this works fine until you use variables as below, because the variable could be of any length, meaning the screen output for line 2 will have the ultimate # out of alignment. Is there a simple way round this?... (1 Reply)
Discussion started by: de_la_espada
1 Replies

2. Programming

Aligning for boundary conditions

Hi, I have tcp/ip client server programs which will communicate through reqest,reply c-structures. As the sizeof(struct) may give different value between client and server programs, how do i align properly for boundary conditions. Could anybody please give some suggestion. Thanks in... (3 Replies)
Discussion started by: axes
3 Replies

3. Shell Programming and Scripting

Aligning text files by max field length

Hello, Is there anyway that I can align a pipe delimited text file by the maxium field length where the field is separated out by pipes for large text files with more than 100,000 rows? So, far I have searched other forums and google about aligning text files in unix and I have noticed that... (7 Replies)
Discussion started by: physalis2099
7 Replies

4. Shell Programming and Scripting

Aligning numbers in the second file based on first file

Hi All, I have two sets of files with names .dat and .txt. The number of files is really large more than 90000. The files have names like 1.dat, 2.dat,3.dat and so on where as txt files have names like 1.txt, 2.txt, 3.txt and so on The DAT and TXT files are equal in number. About 90000 each ... (4 Replies)
Discussion started by: shoaibjameel123
4 Replies

5. Shell Programming and Scripting

Aligning columns in a text file using Perl

Hi All, I am new to perl and was trying to write a simple program which will generate a text file as output.. now the output which i am getting is something like this.. ================================================================================================== Col1 ... (8 Replies)
Discussion started by: smarty86
8 Replies

6. UNIX for Dummies Questions & Answers

Help with Aligning the content of a txt file

Hello friends Please help me to display the content of a file in specific aligned manner. for ex. the content of the file may be >$TEST WELCOME HI HELLO UNIX SHELL SCRIPTING >$ I want to display the content like . TEST WELCOME HI HELLO ... (18 Replies)
Discussion started by: rajmohan146
18 Replies

7. Shell Programming and Scripting

Aligning output with null fields in shell script

Hello Gurus ! I have what probably amounts to a few simply changes to fix; however for the life of me I cannot seem to get it ti work. I need to align the output of my script (I am writing to a logfile)... here's the lines in my code: if then echo "NODE: $node" >> $logfile... (6 Replies)
Discussion started by: gvolpini
6 Replies

8. Shell Programming and Scripting

Aligning data

Hi Guys, How can you align data getting the UID, GID HOSTNAME in same column input: server1 uid=1010(faculty) gid=700(teacher) groups=700(teacher), 800(models) student:x:500:500:student:/home/student:/bin/bash server2 uid=1010(OSAD) gid=700(teacher) groups=700(teacher), 809(staff)... (5 Replies)
Discussion started by: invinzin21
5 Replies

9. Shell Programming and Scripting

Aligning Texts

is there any way to align my text so every column begins on the same line as the previous line? here's my command: printf "THEN ( ${SEARCHPATTB} = Hour = ${CALTOTB} ) %8s => %8s NOW ( ${SEARCHPATT} = Hour = ${CALTOT} ) %7s => %7s Reduced By: %7s -${RESULT}"\\n output i'm currently getting... (2 Replies)
Discussion started by: SkySmart
2 Replies

10. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
Locale::Codes::LangFam(3)				User Contributed Perl Documentation				 Locale::Codes::LangFam(3)

NAME
Locale::Codes::LangFam - standard codes for language extension identification SYNOPSIS
use Locale::Codes::LangFam; $lext = code2langfam('apa'); # $lext gets 'Apache languages' $code = langfam2code('Apache languages'); # $code gets 'apa' @codes = all_langfam_codes(); @names = all_langfam_names(); DESCRIPTION
The "Locale::Codes::LangFam" module provides access to standard codes used for identifying language families, such as those as defined in ISO 639-5. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 639-5 language family codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language families. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lext = code2langfam('apa','alpha'); $lext = code2langfam('apa',LOCALE_LANGFAM_ALPHA); The codesets currently supported are: alpha This is the set of three-letter (lowercase) codes from ISO 639-5 such as 'apa' for Apache languages. This is the default code set. ROUTINES
code2langfam ( CODE [,CODESET] ) langfam2code ( NAME [,CODESET] ) langfam_code2code ( CODE ,CODESET ,CODESET2 ) all_langfam_codes ( [CODESET] ) all_langfam_names ( [CODESET] ) Locale::Codes::LangFam::rename_langfam ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangFam::add_langfam ( CODE ,NAME [,CODESET] ) Locale::Codes::LangFam::delete_langfam ( CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_alias ( NAME ,NEW_NAME ) Locale::Codes::LangFam::delete_langfam_alias ( NAME ) Locale::Codes::LangFam::rename_langfam_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::add_langfam_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangFam::delete_langfam_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.loc.gov/standards/iso639-5/id.php ISO 639-5 . AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2013 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-02-27 Locale::Codes::LangFam(3)
All times are GMT -4. The time now is 05:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy