Sponsored Content
Top Forums Shell Programming and Scripting need shell script to get last 10 char from a file name and write in to a new file Post 302219129 by ghostdog74 on Monday 28th of July 2008 07:09:56 AM
Old 07-28-2008
you said to get last 10 char from a file name, or is it last 10 char of file content? if its file name
Code:
file="testfile1234567890"
echo $file | cut -c10-

if its last 10 char of file content
Code:
tail -c10 filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to write a shell script that print the last modified file ?

Hi guys, -could any one help me with this (I'm new to UNIX) how to write a shell script that tell me the last modified file in the current directory? so if I run the script in a diferent directory,will work. and can I write the script by C++ language and run it in the shell ? I tried... (5 Replies)
Discussion started by: FunnyWolF
5 Replies

2. Shell Programming and Scripting

How to write a shell script to notify when certain texts appear in a file?

I have a server and occasionally the file mysqld.log would show something like /usr/libexec/mysqld: Disk is full writing './example_com_-_wordpress/wp_statpress.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs How do I write a simple shell script to check mysqld.log... (1 Reply)
Discussion started by: acider
1 Replies

3. Shell Programming and Scripting

How to write shell script for input file name format checking?

Hello, I had written a shell script that accepts input file as cmd line argument and process this file. if ; then if ; then . $1 LOGFILE="$LOG_FILE/MIG_BIOS.log"; get_input_file else ERROR_CODE=MSCRM0005_003 error "$ERROR_CODE : Input file $1 is not available"; exit... (3 Replies)
Discussion started by: Poonamol
3 Replies

4. Shell Programming and Scripting

write shell script to search file in folder

hi .. i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Discussion started by: shubhig15
1 Replies

5. Shell Programming and Scripting

write shell script to rename file

hi, I need some help in writing shell script in a bourne shell.I am trying to rename the file.. eg. find /root/data -type f -name "text*) | while read FILES do newfile=${FILES/type_2.0_20101208_34.xml / tmp.xml} mv "$FILES" "$newfile" done above written script is working...If the... (7 Replies)
Discussion started by: shubhig15
7 Replies

6. Shell Programming and Scripting

Write output to a file using Korn shell script

All, Can anyone please help me with the below scenario in korn shell script. Can anyone please give me some hints to proceed on this. I have a Flat file of the below format. Input file format:... (1 Reply)
Discussion started by: sp999
1 Replies

7. Shell Programming and Scripting

how to write multiple lines to a file using shell script?

I need to create an xml using shell script, but i first want to know how can i write multiple lines to file using shell script? (7 Replies)
Discussion started by: vel4ever
7 Replies

8. Shell Programming and Scripting

How can I write the specific content in the file through shell script

Hello, I need to do one thing that my script creates the file touch release.SPLASH_12_03_00_RC01.txt Now I want to update that file with some content e.g splashbuild::SPLASH_12_17_00_RC02.zip Thanks (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

9. Shell Programming and Scripting

Need to write shell script for my .sql file call

Hi Guys, I need to write a simple shell script which will generate a .csv file/report by calling .sql file inside a shell script. Can somebody help me on this. Thanks in advance! Regards, LK (7 Replies)
Discussion started by: lakshmanraok117
7 Replies

10. Shell Programming and Scripting

Need help to write a shell script to convert text file to excel file.

Hi Everyone, I want your help to write a script which will take text file as input and on the basis of delimiter ":"script will create excel sheet. Example input: IpAdress:InstanceName:Port:ServerName 10.255.255.1:abc:2232:xyz_abc Output should be an excel sheet like below: Column... (8 Replies)
Discussion started by: akabhinav18
8 Replies
LIBXO(3)						   BSD Library Functions Manual 						  LIBXO(3)

NAME
xo_err -- emit errors and warnings in multiple formats LIBRARY
library ``libxo'' SYNOPSIS
#include <libxo/xo.h> void xo_warn(const char *fmt, ...); void xo_warnx(const char *fmt, ...); void xo_warn_c(int code, const char *fmt, ...); void xo_warn_hc(xo_handle_t *xop, int code, const char *fmt, ...); void xo_err(int eval, const char *fmt, ...); void xo_errc(int eval, int code, const char *fmt, ...); void xo_errx(int eval, const char *fmt, ...); void xo_message(const char *fmt, ...); void xo_message_c(int code, const char *fmt, ...); void xo_message_hc(xo_handle_t *xop, int code, const char *fmt, ...); void xo_message_hcv(xo_handle_t *xop, int code, const char *fmt, va_list vap); DESCRIPTION
Many programs make use of the standard library functions err(3) and warn(3) to generate errors and warnings for the user. libxo wants to pass that information via the current output style, and provides compatible functions to allow this. These functions display the program name, a colon, a formatted message based on the arguments, and then optionally a colon and an error mes- sage associated with either errno or the code parameter. EXAMPLE: if (open(filename, O_RDONLY) < 0) xo_err(1, "cannot open file '%s'", filename); ADDITIONAL DOCUMENTATION
Complete documentation can be found on github: http://juniper.github.io/libxo/libxo-manual.html libxo lives on github as: https://github.com/Juniper/libxo The latest release of libxo is available at: https://github.com/Juniper/libxo/releases SEE ALSO
xo_emit(3) HISTORY
The libxo library was added in FreeBSD 11.0. AUTHOR
Phil Shafer BSD
December 4, 2014 BSD
All times are GMT -4. The time now is 08:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy